chrome.runtime.onSuspend.addListener not firing

时光总嘲笑我的痴心妄想 提交于 2020-01-05 22:43:46

问题


I am having a chrome extension connected to native messaging application. I need to do some cleanup when the chrome extension suspends. I am trying to use chrome.runtime.onSuspend.addListener but it is not working. Here is my code : -

Manifest.json

"background": {"scripts": ["background.js"], 
               "persistent": false},   

background.js

    function Connect() {
        console.log("Connected");

        ext = chrome.runtime.connectNative('foxtrot');   
        chrome.runtime.onSuspend.addListener(function () {
            ext.postMessage({ message: "clean and close" });   
        });
    }

来源:https://stackoverflow.com/questions/27311204/chrome-runtime-onsuspend-addlistener-not-firing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!