:contruction: Porting TS to JS
This commit is contained in:
parent
2dbebb87d6
commit
1f10829426
26 changed files with 1910 additions and 792 deletions
22
src/hooks.js
Normal file
22
src/hooks.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
export default function hooks ()
|
||||
{
|
||||
this._hooks = {};
|
||||
this.all = ['preRenderSvg', 'postRenderSvg', 'insertText'];
|
||||
|
||||
this.prototype.list = function (hook)
|
||||
{
|
||||
if(typeof this._hooks[hook] === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this._hooks[hook];
|
||||
}
|
||||
|
||||
this.prototype.attach = function (hook, obj)
|
||||
{
|
||||
if(typeof this._hooks[hook] === 'undefined') return;
|
||||
for(let func of this._hooks[hook]) {
|
||||
obj.pre(hook, func);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue