调整大小事件不适用于附加 SDK (1.8) 中的内容脚本
此脚本中的内容脚本:https ://builder.addons.mozilla.org/package/142401/latest/
主.js:
var Widget = require("widget").Widget;
var tabs = require('tabs');
var self = require('self');
var data = self.data;
var PageMod = require('page-mod').PageMod;
exports.main = function() {
PageMod({
include: [data.url("thepage.html")],
contentScriptWhen: 'start',
contentScriptFile: [data.url('thescript.js')],
onAttach: function(worker) {
console.log("attaching...")
},
});
new Widget({
id: "my-widget-1",
label: "Widget",
contentURL: "http://www.mozilla.org/favicon.ico",
onClick: function(event) {
tabs.open(data.url("thepage.html"));
}
});
};
脚本.js
console.log('started')
window.onresize = function(){console.log('resized!!!');}; //not working, never calls
如何在内容脚本中触发调整大小事件?