From 0776685e6f9ee8cd882a88d8d1b3df83c0eb678f Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Thu, 3 Oct 2019 21:53:08 -0700 Subject: [PATCH] [Service][UI] Expose functions and properties of global object 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 --- wrt_app/src/runtime.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wrt_app/src/runtime.js b/wrt_app/src/runtime.js index 58d3a71..7876a81 100755 --- a/wrt_app/src/runtime.js +++ b/wrt_app/src/runtime.js @@ -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); -- 2.7.4