与chrome.webRequest.onBeforeRequest.removeListener 相关?-- 如何停止 chrome 网络监听器,我正在尝试使用 dart:js 取消注册监听器
调用后onBeforeRequest.callMethod('removeListener', [callback]);
,我注意到仍在调用侦听器。此外,在添加侦听器后直接hasListener
返回false
(即使正在注册侦听器)。
var callback = (map) { /* some code */ };
var filter = new JsObject.jsify({"key": "value"});
var opt_extraInfoSpec = new JsObject.jsify(["extra opt"]);
// chrome.webRequest.onBeforeRequest.addListener
JsObject onBeforeRequest = context['chrome']['webRequest']['onBeforeRequest'];
onBeforeRequest.callMethod('addListener', [callback, filter, opt_extraInfoSpec]);
Logger.root.fine('main(): does callback exist: ${onBeforeRequest.callMethod('hasListener', [callback])}');