Plugin/Plugin.ts

  1. /**
  2. * Copyright (c) 2017 ~ present NAVER Corp.
  3. * billboard.js project is licensed under the MIT license
  4. */
  5. /**
  6. * Base class to generate billboard.js plugin
  7. * @class Plugin
  8. */
  9. /**
  10. * Version info string for plugin
  11. * @name version
  12. * @static
  13. * @memberof Plugin
  14. * @type {string}
  15. * @example
  16. * bb.plugin.stanford.version; // ex) 1.9.0
  17. */
  18. export default class Plugin {
  19. public $$;
  20. public options;
  21. static version = "__VERSION__";
  22. /**
  23. * Constructor
  24. * @param {Any} options config option object
  25. * @private
  26. */
  27. constructor(options = {}) {
  28. this.options = options;
  29. }
  30. /**
  31. * Lifecycle hook for 'beforeInit' phase.
  32. * @private
  33. */
  34. $beforeInit() {}
  35. /**
  36. * Lifecycle hook for 'init' phase.
  37. * @private
  38. */
  39. $init() {}
  40. /**
  41. * Lifecycle hook for 'afterInit' phase.
  42. * @private
  43. */
  44. $afterInit() {}
  45. /**
  46. * Lifecycle hook for 'redraw' phase.
  47. * @private
  48. */
  49. $redraw() {}
  50. /**
  51. * Lifecycle hook for 'willDestroy' phase.
  52. * @private
  53. */
  54. $willDestroy() {
  55. Object.keys(this).forEach(key => {
  56. this[key] = null;
  57. delete this[key];
  58. });
  59. }
  60. }