
function onCreate(uri) {
    var evue = require("router.js");
    var router = evue.router;
    globalThis.$ww = require('ww_server.js')
    if( globalThis.$ww )
        globalThis.$ww.setup("/dev/ttyProto", 115200)
    if (startUrl() == undefined) {
        router.push({ 'path': uri });
    } else {
        var uriObj = JSON.parse(globalThat.$uri);
        router.push(uriObj);
    }
}

function createJobWindow(report, count) {
    var lvgl = require("@native.lvgl7");
    var router = require("@system.router");
    var rootWindow = router.currentPage.rootObj;
    var indexObj = router.currentPage.$indexObj;
    console.log(indexObj)
    indexObj.$mount("evue_report", rootWindow);
}

function onKeyEvent(code) {
    var router = require("@system.router");
    if (code == 62) {
        router.pageDebug(!router.debugOn);
    }
}

function onDestroy() {
    var router = require("@system.router");
    router.quit();
}

function onGestureEvent(dir, x, y) {
    var router = require("@system.router");
    var indexObj = router.currentPage.$indexObj;
    if (indexObj.hasOwnProperty('onGestureEvent')) {
        indexObj.onGestureEvent(dir, x, y);
    }
}

globalThis.$blocks = {};

EvueApp({
    "font": "msyh-mdd.ttf",
    'onCreate': onCreate,
    'onDestroy': onDestroy,
    'onGestureEvent': onGestureEvent,
    'onKeyEvent': onKeyEvent,
    'paths': ['./', '../../simulator/enode_modules/', '../../enode_modules/'],
    'uri': 'page0',
}) 
    