-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin): Add JS Plugin class file
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
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; | ||
}); | ||
} | ||
} |