[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 58d3a71ddb64f2d9b5c2d10f4b0b20d8ebcd9796..7876a81624abed049831bb94fe0e835d768b3995 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);