1
0
Fork 0

🚧 Fixing prototype issues

This commit is contained in:
Joost De Cock 2018-07-23 20:14:32 +02:00
parent 7758ba81a6
commit 9fbef27330
9 changed files with 1482 additions and 1467 deletions

View file

@ -1,19 +1,19 @@
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);
}
};
}
hooks.prototype.list = function(hook) {
if (typeof this._hooks[hook] === "undefined") {
return false;
}
return this._hooks[hook];
};
hooks.prototype.attach = function(hook, obj) {
if (typeof this._hooks[hook] === "undefined") return;
for (let func of this._hooks[hook]) {
obj.pre(hook, func);
}
};