From 34a5c436db3271c72f91cf0f028c934d6474c902 Mon Sep 17 00:00:00 2001 From: portix Date: Tue, 19 Mar 2013 01:05:10 +0100 Subject: New Signal api --- extensions/requestpolicy | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'extensions/requestpolicy') diff --git a/extensions/requestpolicy b/extensions/requestpolicy index 9af23275..6ceee7a3 100644 --- a/extensions/requestpolicy +++ b/extensions/requestpolicy @@ -109,12 +109,6 @@ var defaultConfig = { }; var config = {}; -var sigs = { - resource : -1, - navigation : -1, - loadFinished : -1 -}; - var persistentList = null; var tmpList = {}; @@ -412,23 +406,6 @@ function loadFinishedCB(wv) io.notify("RP: blocked " + blocked + " requests"); } -function connect() -{ - sigs.resource = signals.connect("resource", resourceCB); - sigs.navigation = signals.connect("navigation", navigationCB); - if (config.notify) - sigs.loadFinished = signals.connect("loadFinished", loadFinishedCB); -} -function disconnect() -{ - sigs.forEach(function (key, value) { - if (value != -1) - { - signals.disconnect(value); - sigs[key] = -1; - } - }); -}//}}} var requestpolicy = { defaultConfig : defaultConfig, init : function(c) @@ -448,7 +425,10 @@ var requestpolicy = { } } persistentList = persistentList || {}; - connect(); + Signal.connect("resource", resourceCB); + Signal.connect("navigation", navigationCB); + if (config.notify) + Signal.connect("loadFinished", loadFinishedCB); bind(config.shortcut, showMenu, "requestpolicy"); bind(config.unblockCurrent, unblockCurrent, "requestpolicyUnblockCurrent"); bind(config.unblockAll, unblockAll, "requestpolicyUnblockAll"); @@ -457,6 +437,9 @@ var requestpolicy = { end : function () { disconnect(); + Signal.disconnect(resourceCB); + Signal.disconnect(navigationCB); + Signal.disconnect(loadFinishedCB); unbind("requestpolicy"); unbind("requestpolicyUnblockCurrent"); unbind("requestpolicyUnblockAll"); -- cgit v1.2.3