summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHyun Song <dh81.song@samsung.com>2022-03-08 17:35:55 +0900
committerDongHyun Song <dh81.song@samsung.com>2022-03-08 17:41:58 +0900
commit937fc3e4fd8c9a3dd32974a4e261d82e4db31b73 (patch)
tree1cf2f8f4eee84e05913195ce8106f0fb65ae8b67
parente65114c24bc21f3d97bcbf60c6c0204e94107f94 (diff)
downloadwebapi-plugins-937fc3e4fd8c9a3dd32974a4e261d82e4db31b73.tar.gz
webapi-plugins-937fc3e4fd8c9a3dd32974a4e261d82e4db31b73.tar.bz2
webapi-plugins-937fc3e4fd8c9a3dd32974a4e261d82e4db31b73.zip
Add 'self' as global scope for web worker
In web worker world, 'self' is defined global scope object. This change is necessary to apply tizen webapis on web worker for specific purpose. (i.e. tizen.ml) Change-Id: Ie9602ea4f492589dad2c87e3c0bd8e2602278c02 Signed-off-by: DongHyun Song <dh81.song@samsung.com>
-rw-r--r--src/utils/utils_api.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js
index 5f7b478f..7d184af3 100644
--- a/src/utils/utils_api.js
+++ b/src/utils/utils_api.js
@@ -11,10 +11,12 @@ exports.JSON = JSON_;
var _enableJsLogs = false;
var _global = {};
-if (typeof window != 'undefined') {
+if (typeof window !== 'undefined') {
_global = window;
-} else if (typeof global != 'undefined') {
+} else if (typeof global !== 'undefined') {
_global = global;
+} else if (typeof self !== 'undefined') {
+ _global = self;
}
/**
@@ -1655,6 +1657,8 @@ if (typeof window !== 'undefined') {
scope = window;
} else if (typeof global !== 'undefined') {
scope = global;
+} else if (typeof self !== 'undefined') {
+ scope = self;
}
scope = scope || {};
scope.WebAPIException = WebAPIException;