File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " cos-js-sdk-v5" ,
3- "version" : " 1.3.9 " ,
3+ "version" : " 1.3.10 " ,
44 "description" : " JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)" ,
55 "main" : " index.js" ,
66 "types" : " index.d.ts" ,
Original file line number Diff line number Diff line change @@ -78,6 +78,6 @@ COS.util = {
7878 json2xml : util . json2xml ,
7979} ;
8080COS . getAuthorization = util . getAuth ;
81- COS . version = '1.3.9 ' ;
81+ COS . version = '1.3.10 ' ;
8282
8383module . exports = COS ;
Original file line number Diff line number Diff line change @@ -710,7 +710,13 @@ var error = function (err, opt) {
710710}
711711
712712var isNode = function ( ) {
713- return typeof window !== 'object' && typeof process === 'object' && typeof require === 'function' ;
713+ // 得兜底 web worker 环境中 webpack 用了 process 插件之类的情况
714+ return typeof window !== 'object' && typeof process === 'object' && typeof require === 'function' && ! isWebWorker ( ) ;
715+ }
716+
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 ;
714720}
715721
716722var isCIHost = function ( url ) {
You can’t perform that action at this time.
0 commit comments