Skip to content

Commit ed66e79

Browse files
committed
rebuild
1 parent 3d32525 commit ed66e79

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

dist/cos-js-sdk-v5.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,14 @@ var error = function (err, opt) {
765765
return err;
766766
};
767767

768+
var isWebWorker = function () {
769+
// 有限判断 worker 环境的 constructor name 其次用 worker 独有的 FileReaderSync 兜底 详细参考 https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Workers_API/Using_web_workers
770+
return typeof globalThis === 'object' && (globalThis.constructor.name === 'DedicatedWorkerGlobalScope' || globalThis.FileReaderSync);
771+
};
772+
768773
var isNode = function () {
769-
return typeof window !== 'object' && typeof process === 'object' && "function" === 'function';
774+
// 得兜底 web worker 环境中 webpack 用了 process 插件之类的情况
775+
return typeof window !== 'object' && typeof process === 'object' && "function" === 'function' && !isWebWorker();
770776
};
771777

772778
var isCIHost = function (url) {
@@ -2957,7 +2963,7 @@ COS.util = {
29572963
json2xml: util.json2xml
29582964
};
29592965
COS.getAuthorization = util.getAuth;
2960-
COS.version = '1.3.9';
2966+
COS.version = '1.3.10';
29612967

29622968
module.exports = COS;
29632969

dist/cos-js-sdk-v5.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,15 +709,17 @@ var error = function (err, opt) {
709709
return err;
710710
}
711711

712+
var isWebWorker = function () {
713+
// 有限判断 worker 环境的 constructor name 其次用 worker 独有的 FileReaderSync 兜底 详细参考 https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Workers_API/Using_web_workers
714+
return typeof globalThis === 'object' && (globalThis.constructor.name === 'DedicatedWorkerGlobalScope' || globalThis.FileReaderSync);
715+
}
716+
712717
var isNode = function () {
713718
// 得兜底 web worker 环境中 webpack 用了 process 插件之类的情况
714719
return typeof window !== 'object' && typeof process === 'object' && typeof require === 'function' && !isWebWorker();
715720
}
716721

717-
var isWebWorker = function () {
718-
// 有限判断 worker 环境的 constructor name 其次用 worker 独有的 FileReaderSync 兜底 详细参考 https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Workers_API/Using_web_workers
719-
return globalThis.constructor.name === 'DedicatedWorkerGlobalScope' || globalThis.FileReaderSync;
720-
}
722+
721723

722724
var isCIHost = function(url) {
723725
return /^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(url);

0 commit comments

Comments
 (0)