Skip to content

Commit d4d85c6

Browse files
authored
fix 1.4.8 (#160)
* fix 1.4.8 * upd Co-authored-by: chrisftian <[email protected]>
1 parent ffb0bef commit d4d85c6

File tree

4 files changed

+26
-31
lines changed

4 files changed

+26
-31
lines changed

dist/cos-js-sdk-v5.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7212,7 +7212,7 @@ module.exports = function(module) {
72127212
/*! exports provided: name, version, description, main, types, scripts, repository, keywords, author, license, bugs, homepage, dependencies, devDependencies, default */
72137213
/***/ (function(module) {
72147214

7215-
module.exports = JSON.parse("{\"name\":\"cos-js-sdk-v5\",\"version\":\"1.4.7\",\"description\":\"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)\",\"main\":\"dist/cos-js-sdk-v5.js\",\"types\":\"index.d.ts\",\"scripts\":{\"server\":\"node server/sts.js\",\"dev\":\"cross-env NODE_ENV=development webpack -w --mode=development\",\"build\":\"cross-env NODE_ENV=production webpack --mode=production\",\"cos-auth.min.js\":\"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/tencentyun/cos-js-sdk-v5.git\"},\"keywords\":[],\"author\":\"carsonxu\",\"license\":\"ISC\",\"bugs\":{\"url\":\"https://github.com/tencentyun/cos-js-sdk-v5/issues\"},\"homepage\":\"https://github.com/tencentyun/cos-js-sdk-v5#readme\",\"dependencies\":{\"@xmldom/xmldom\":\"^0.8.2\"},\"devDependencies\":{\"@babel/core\":\"7.17.9\",\"@babel/plugin-transform-runtime\":\"7.18.10\",\"@babel/preset-env\":\"7.16.11\",\"babel-loader\":\"8.2.5\",\"body-parser\":\"^1.18.3\",\"cross-env\":\"^5.2.0\",\"express\":\"^4.16.4\",\"qcloud-cos-sts\":\"^3.0.2\",\"request\":\"^2.87.0\",\"terser-webpack-plugin\":\"4.2.3\",\"webpack\":\"4.46.0\",\"webpack-cli\":\"4.10.0\"}}");
7215+
module.exports = JSON.parse("{\"name\":\"cos-js-sdk-v5\",\"version\":\"1.4.8\",\"description\":\"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)\",\"main\":\"dist/cos-js-sdk-v5.js\",\"types\":\"index.d.ts\",\"scripts\":{\"server\":\"node server/sts.js\",\"dev\":\"cross-env NODE_ENV=development webpack -w --mode=development\",\"build\":\"cross-env NODE_ENV=production webpack --mode=production\",\"cos-auth.min.js\":\"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/tencentyun/cos-js-sdk-v5.git\"},\"keywords\":[],\"author\":\"carsonxu\",\"license\":\"ISC\",\"bugs\":{\"url\":\"https://github.com/tencentyun/cos-js-sdk-v5/issues\"},\"homepage\":\"https://github.com/tencentyun/cos-js-sdk-v5#readme\",\"dependencies\":{\"@xmldom/xmldom\":\"^0.8.2\"},\"devDependencies\":{\"@babel/core\":\"7.17.9\",\"@babel/plugin-transform-runtime\":\"7.18.10\",\"@babel/preset-env\":\"7.16.11\",\"babel-loader\":\"8.2.5\",\"body-parser\":\"^1.18.3\",\"cross-env\":\"^5.2.0\",\"express\":\"^4.16.4\",\"qcloud-cos-sts\":\"^3.0.2\",\"request\":\"^2.87.0\",\"terser-webpack-plugin\":\"4.2.3\",\"webpack\":\"4.46.0\",\"webpack-cli\":\"4.10.0\"}}");
72167216

72177217
/***/ }),
72187218

@@ -13726,7 +13726,8 @@ var Tracker = /*#__PURE__*/function () {
1372613726
deepTracker = opt.deepTracker;
1372713727
var appid = bucket && bucket.substr(bucket.lastIndexOf('-') + 1) || '';
1372813728
this.parent = parent;
13729-
this.deepTracker = deepTracker; // 上报用到的字段
13729+
this.deepTracker = deepTracker;
13730+
this.delay = delay; // 上报用到的字段
1373013731

1373113732
this.params = {
1373213733
// 通用字段
@@ -13859,18 +13860,19 @@ var Tracker = /*#__PURE__*/function () {
1385913860
}
1386013861

1386113862
var eventCode = getEventCode(this.params.name);
13862-
var formattedParams = formatParams(this.params);
13863+
var formattedParams = formatParams(this.params); // 兜底处理
1386313864

13864-
if (this.params.delay === 0) {
13865+
if (!this.beacon) {
13866+
this.beacon = getBeacon(this.delay || 5000);
13867+
}
13868+
13869+
if (this.delay === 0) {
1386513870
// 实时上报
13866-
this.beacon.onDirectUserAction(eventCode, formattedParams);
13871+
this.beacon && this.beacon.onDirectUserAction(eventCode, formattedParams);
1386713872
} else {
1386813873
// 周期性上报
13869-
this.beacon.onUserAction(eventCode, formattedParams);
13870-
} // 上报结束即销毁
13871-
13872-
13873-
this.destroy();
13874+
this.beacon && this.beacon.onUserAction(eventCode, formattedParams);
13875+
}
1387413876
} // 生成子实例,与父所属一个链路,可用于分块上传内部流程上报单个分块操作
1387513877

1387613878
}, {
@@ -13884,16 +13886,9 @@ var Tracker = /*#__PURE__*/function () {
1388413886
region: this.params.region,
1388513887
fileKey: this.params.requestPath,
1388613888
customId: this.params.customId,
13887-
delay: this.params.delay
13889+
delay: this.delay
1388813890
});
1388913891
return new Tracker(subParams);
13890-
} // 链路结束后销毁实例
13891-
13892-
}, {
13893-
key: "destroy",
13894-
value: function destroy() {
13895-
this.beacon = null;
13896-
this.params = {};
1389713892
}
1389813893
}]);
1389913894

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.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cos-js-sdk-v5",
3-
"version": "1.4.7",
3+
"version": "1.4.8",
44
"description": "JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)",
55
"main": "dist/cos-js-sdk-v5.js",
66
"types": "index.d.ts",

src/tracker.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ class Tracker {
207207
const appid = bucket && bucket.substr(bucket.lastIndexOf('-') + 1) || '';
208208
this.parent = parent;
209209
this.deepTracker = deepTracker;
210+
this.delay = delay;
210211
// 上报用到的字段
211212
this.params = {
212213
// 通用字段
@@ -311,15 +312,19 @@ class Tracker {
311312
}
312313
const eventCode = getEventCode(this.params.name);
313314
const formattedParams = formatParams(this.params);
314-
if (this.params.delay === 0) {
315+
316+
// 兜底处理
317+
if (!this.beacon) {
318+
this.beacon = getBeacon(this.delay || 5000);
319+
}
320+
321+
if (this.delay === 0) {
315322
// 实时上报
316-
this.beacon.onDirectUserAction(eventCode, formattedParams);
323+
this.beacon && this.beacon.onDirectUserAction(eventCode, formattedParams);
317324
} else {
318325
// 周期性上报
319-
this.beacon.onUserAction(eventCode, formattedParams);
326+
this.beacon && this.beacon.onUserAction(eventCode, formattedParams);
320327
}
321-
// 上报结束即销毁
322-
this.destroy();
323328
}
324329

325330
// 生成子实例,与父所属一个链路,可用于分块上传内部流程上报单个分块操作
@@ -332,16 +337,11 @@ class Tracker {
332337
region: this.params.region,
333338
fileKey: this.params.requestPath,
334339
customId: this.params.customId,
335-
delay: this.params.delay,
340+
delay: this.delay,
336341
});
337342
return new Tracker(subParams);
338343
}
339344

340-
// 链路结束后销毁实例
341-
destroy() {
342-
this.beacon = null;
343-
this.params = {};
344-
}
345345
}
346346

347347
module.exports = Tracker;

0 commit comments

Comments
 (0)