deprecatedMethod.js 777 B

12345678910111213141516171819202122232425262728293031
  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 `' +
  17. method +
  18. '`.' +
  19. (instead ? ' Use `' + instead + '` instead.' : '') +
  20. ' This method will be removed in a future release.'
  21. );
  22. if (docs) {
  23. console.warn('For more information about usage see ' + docs);
  24. }
  25. } catch (e) {
  26. /* Ignore */
  27. }
  28. }