awesome-chrome-extension-boilerplate
awesome-chrome-extension-boilerplate copied to clipboard
ts 内popup 如何与background通信呢?
在popup 定义 var back= chrome.extension.getBackGroundPage(); 调用background 的方法出错了,找不到方法 back.test();
通过 window.test = function() {} 在 background 中定义 test 方法应该就没问题了
通过 window.test = function() {} 在 background 中定义 test 方法应该就没问题了
不行,var back= chrome.extension.getBackGroundPage() back 返回的就是一个window 对象,但是在background 并不能直接用window 对象
推荐使用 https://github.com/zikaari/webext-bridge#readme