diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 653d21bc1..b66b530f7 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -820,6 +820,9 @@ Callbacks.prototype.push = function(_arg) { var cb, name; name = _arg.name, cb = _arg.cb; + if (this[name]) { + this.rm(name); + } this[name] = cb; return this.keys.push(name); }; diff --git a/builds/crx/script.js b/builds/crx/script.js index 0870781dc..c2a9a092b 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -825,6 +825,9 @@ Callbacks.prototype.push = function(_arg) { var cb, name; name = _arg.name, cb = _arg.cb; + if (this[name]) { + this.rm(name); + } this[name] = cb; return this.keys.push(name); }; diff --git a/src/General/lib/callbacks.class b/src/General/lib/callbacks.class index fcb735b2b..22afb222c 100644 --- a/src/General/lib/callbacks.class +++ b/src/General/lib/callbacks.class @@ -3,6 +3,8 @@ class Callbacks @keys = [] push: ({name, cb}) -> + @rm name if @[name] + @[name] = cb @keys.push name