[Service][UI] Expose functions and properties of global object 44/215244/3
authorYoungsoo Choi <kenshin.choi@samsung.com>
Fri, 4 Oct 2019 04:53:08 +0000 (21:53 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Fri, 4 Oct 2019 05:27:39 +0000 (22:27 -0700)
This enables functions and properties of global object,
such as setInterval, setTimeout, and etc in ui service apps.

Change-Id: Iebf68a53fc1e0f59e71c03f6ed38eae0d17a138a
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
wrt_app/src/runtime.js

index 58d3a71..7876a81 100755 (executable)
@@ -190,6 +190,9 @@ class Runtime {
                         module: new Module,
                         require: require,
                     };
+                    for(let key in global) {
+                        _this.sandbox[app_id][key] = global[key];
+                    }
                     let options = {};
                     let code = fs.readFileSync(params[1]);
                     vm.runInNewContext(code, _this.sandbox[app_id], options);