deprecatedMethod.js 746 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. /*eslint no-console:0*/
  3. /**
  4. * Supply a warning to the developer that a method they are using
  5. * has been deprecated.
  6. *
  7. * @param {string} method The name of the deprecated method
  8. * @param {string} [instead] The alternate method to use if applicable
  9. * @param {string} [docs] The documentation URL to get further details
  10. *
  11. * @returns {void}
  12. */
  13. export default function deprecatedMethod(method, instead, docs) {
  14. try {
  15. console.warn(
  16. 'DEPRECATED method `' + method + '`.' +
  17. (instead ? ' Use `' + instead + '` instead.' : '') +
  18. ' This method will be removed in a future release.');
  19. if (docs) {
  20. console.warn('For more information about usage see ' + docs);
  21. }
  22. } catch (e) { /* Ignore */ }
  23. }