javascripttizentizen-emulator

Tizen SDK: Can't find variable: tizen


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: Can't find variable: tizen

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);

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.


Solution

  • I don't know how it is working now, but I found the solution. I just changed the workspace and it worked.