From: DongHyun Song Date: Tue, 8 Mar 2022 08:35:55 +0000 (+0900) Subject: Add 'self' as global scope for web worker X-Git-Tag: submit/tizen/20220325.070959~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=937fc3e4fd8c9a3dd32974a4e261d82e4db31b73;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git 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 --- 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;