避免重新加载Google Chrome扩展程序 [英] Avoiding reloading of Google Chrome extension
问题描述
我正在开发Google Chrome扩展程序。每当我的JavaScript源文件发生变化时,我发现自己必须再次单击加载解压后的扩展名以使更改生效。
在每次迭代中重新加载扩展是非常乏味的。可以避免吗?
取决于资产,让我们来回顾一下:
资产 ---------------------------- ------------- 需要的操作
popup.html HTML ---------刷新浏览器页面
popup.html JS ----------- --------------------刷新浏览器页面
通过清单显示内容--------- --------通过executeScript(代码) - location.reload(true)
contentscript >在后台页面
通过executeScript(文件)内容浏览器----刷新浏览器页面
background.html HTML ------------------- location.reload(true)
在背景页面上
background.html JS ------------------------ location.reload(true)
在后台页面上
有关如何执行 location.reloa的更多信息d(true)
请参阅调试页面
需要重新加载插件的内容脚本最近已经提出,并得到了铬队的确认:
http://code.google.com/p/chromium/issues/detail?id = 104610
请考虑使用程序化注入( contentscript通过executeScript(file)
),以避免重新加载插件来更新内容脚本。
I am developing Google Chrome extension. Each time my JavaScript source changes, I find myself having to click "load unpacked extension" again to have the changes take effect.
Reloading the extension at each iteration is very tedious. Can it be avoided?
Depends on the asset, lets review:
Asset ----------------------------------------- Action needed
popup.html HTML -------------------------- Refresh browser page
popup.html JS ------------------------------- Refresh browser page
contentscript via manifest ----------------- Reload extension
contentscript via executeScript (code) - location.reload(true)
on background page
contentscript via executeScript (file) ---- Refresh browser page
background.html HTML ------------------- location.reload(true)
on background page
background.html JS ------------------------ location.reload(true)
on background page
For more information on how to do the location.reload(true)
see the page on debugging
The content script requiring a plugin reload has been brought up recently and acknowledged by the chromium team:
http://code.google.com/p/chromium/issues/detail?id=104610
Consider using programmatic injection (contentscript via executeScript (file)
) to avoid having to reload the plugin for content script updates.
这篇关于避免重新加载Google Chrome扩展程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!