Trails Packages
    Preparing search index...

    Function deprecated

    • Creates a deprecation helper for a deprecated entity.

      This helper is used to print a deprecation warning to the browser console when the deprecated functionality is being used.

      Returns a function that should be called when the deprecated entity is being used. The function will print a deprecation warning when usage is detected for the first time. Any further calls will have no effect to prevent spamming the console.

      NOTE: Deprecation warnings are only printed in development builds.

      Example:

      const printDeprecation = deprecated({
      name: "someFunctionName",
      packageName: "some-package",
      since: "v1.2.3",
      alternative: "use xyz instead"
      });

      // Later, when the deprecated function is actually being used:
      function someFunctionName() {
      printDeprecation();
      // ...
      } *

      Parameters

      Returns () => void