🚧 Wrestling with TypeScript
This commit is contained in:
parent
f4d2785972
commit
2dbebb87d6
7 changed files with 16 additions and 22 deletions
18
lib/hooks.ts
18
lib/hooks.ts
|
@ -7,17 +7,6 @@ export class Hooks {
|
|||
this.all = ['preRenderSvg', 'postRenderSvg'];
|
||||
}
|
||||
|
||||
///** Add hook */
|
||||
//on(hook, method): void {
|
||||
// // This gets called from the pattern context
|
||||
// // so 'this' is not actually this class
|
||||
// let self = this.hooks;
|
||||
// if(typeof self._hooks[method] === 'undefined') {
|
||||
// self._hooks[hook] = [];
|
||||
// }
|
||||
// self._hooks[hook].push(method);
|
||||
//}
|
||||
|
||||
list(hook): function[] {
|
||||
if(typeof this._hooks[hook] === 'undefined') {
|
||||
return false;
|
||||
|
@ -26,13 +15,6 @@ export class Hooks {
|
|||
return this._hooks[hook];
|
||||
}
|
||||
|
||||
attachPre (hook: string, obj: object): void {
|
||||
this._attach('pre', hook, obj);
|
||||
}
|
||||
attachPost (hook: string, obj: object): void {
|
||||
this._attach('post', hook, obj);
|
||||
}
|
||||
|
||||
attach (hook: string, obj: object): void {
|
||||
if(typeof this._hooks[hook] === 'undefined') return;
|
||||
for(let func of this._hooks[hook]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue