我正在使用 Dijit(Dojo 工具包)在沙盒页面中生成 HTML 布局,但每次我调用 dijit 文件时,我都会得到 Uncaught unload is not available in packaged apps.
.
现在我不确定这是 Dojo 的问题还是新安全策略对 Chrome 的限制。
我的文件:
/** manifest.json **/
{
"name": "Hello App",
"version": "2.0",
"manifest_version": 2,
"description": "A app that says hello",
"app": {
"background": {
"scripts" : ["js/app.js"]
}
},
"permissions": [
],
"sandbox": {
"pages" : ["live.html"]
}
}
/** js/app.js **/
chrome.app.runtime.onLaunched.addListener(function(){
chrome.app.window.create('live.html', {width:screen.width,
height: screen.height});
});
/** js/helloapp/app.js **/
/** This is the file that actually calls Dijit to build the layout **/
define(function(){
require(["dijit/layout/ContentPane",
"dijit/layout/BorderContainer"]);
});
我将 live.html 排除在外,因为它基本上只是 HTML 结构、对 dojo 加载程序的调用和对 helloapp/app.js
文件的要求。
如果这是 CSP 世界的限制,我是否可以通过其他方式在新的 Chrome 应用程序上使用 Dijit,或者我是否遗漏了什么?
谢谢你的时间
最佳答案
您必须修改 Dojo Core、Dojo Base 和 Dijit 中的所有核心源代码,以删除卸载事件或重新定义它。
close()
和 unload()
非常相似,您可以在此处查看有关为何未实现的线程:
关于javascript - 卸载在沙盒 Chrome 应用程序中不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13514863/