Skip to content

Commit

Permalink
feat(plugin): Add JS Plugin class file
Browse files Browse the repository at this point in the history
Plugin dev from the  JS based project could face extra work
because of the TS based Plugin class.
So, providing JS version will solve the issue.

Fix #1665
  • Loading branch information
netil committed Sep 11, 2020
1 parent 6fc449e commit 4a20480
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions src/Plugin/Plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Copyright (c) 2017 ~ present NAVER Corp.
* billboard.js project is licensed under the MIT license
*/
/**
* Base class to generate billboard.js plugin
* @class Plugin
*/
/**
* Version info string for plugin
* @name version
* @static
* @memberof Plugin
* @type {string}
* @example
* bb.plugin.stanford.version; // ex) 1.9.0
*/
export default class Plugin {
/**
* Version info string for plugin
* @name version
* @static
* @memberof Plugin
* @type {String}
* @example
* bb.plugin.stanford.version; // ex) 1.9.0
*/
static version = "#__VERSION__#";

/**
* Constructor
* @param {Any} options config option object
* @private
*/
constructor(options = {}) {
this.$$;
this.options = options;
}

/**
* Lifecycle hook for 'beforeInit' phase.
* @private
*/
$beforeInit() {}

/**
* Lifecycle hook for 'init' phase.
* @private
*/
$init() {}

/**
* Lifecycle hook for 'afterInit' phase.
* @private
*/
$afterInit() {}

/**
* Lifecycle hook for 'redraw' phase.
* @private
*/
$redraw() {}

/**
* Lifecycle hook for 'willDestroy' phase.
* @private
*/
$willDestroy() {
Object.keys(this).forEach(key => {
this[key] = null;
delete this[key];
});
}
}

0 comments on commit 4a20480

Please sign in to comment.