Tizen SDK:找不到变量:tizen [英] Tizen SDK: Can't find variable: tizen
问题描述
我正在尝试使用 Tizen SDK 创建 Web 应用程序.当我启动应用程序时一切正常,但是当我按下模拟器上的返回"按钮时,没有任何反应,我看到一条消息:
I'm trying to create a web-application using Tizen SDK. When I launch the app everything is fine but when I press a "Back" button on emulator nothing happens and I see a message:
55435/js/main.js:9:ReferenceError:找不到变量:tizen
55435/js/main.js:9:ReferenceError: Can't find variable: tizen
我查看了 main.js
并且有一个代码:
I looked at main.js
and there's a code:
//Initialize function
var init = function () {
// TODO:: Do your initialization job
console.log("init() called");
// add eventListener for tizenhwkey
document.addEventListener('tizenhwkey', function(e) {
if(e.keyName == "back") {
tizen.application.getCurrentApplication().exit(); // HERE IS THE ERROR
}
});
};
$(document).bind('pageinit', init);
一个简单的 alert(window.tizen)
说它是 undefined
所以我认为一些 js 文件没有附加到项目中.以下是 Tizen SDK 生成的脚本:
A simple alert(window.tizen)
said that it is undefined
so I thought that some js file wasn't attached to project. Here are scripts that was generated by Tizen SDK:
<script src="tizen-web-ui-fw/latest/js/jquery.js"></script>
<script src="tizen-web-ui-fw/latest/js/tizen-web-ui-fw-libs.js"></script>
<script src="tizen-web-ui-fw/latest/js/tizen-web-ui-fw.js" data-framework-theme="tizen-white"></script>
<script type="text/javascript" src="./js/main.js"></script>
我认为应该添加一些脚本,但我不知道是哪个.
I think some script should be added but I don't know which one.
推荐答案
我现在不知道它是如何工作的,但我找到了解决方案.我刚刚更改了工作区,它起作用了.
I don't know how it is working now, but I found the solution. I just changed the workspace and it worked.
这篇关于Tizen SDK:找不到变量:tizen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!