Skip to content

Commit

Permalink
fix 1.4.8 (#160)
Browse files Browse the repository at this point in the history
* fix 1.4.8

* upd

Co-authored-by: chrisftian <chrisftian@tencent.com>
  • Loading branch information
livehigh and livehigh authored Sep 6, 2022
1 parent ffb0bef commit d4d85c6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 31 deletions.
31 changes: 13 additions & 18 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -7212,7 +7212,7 @@ module.exports = function(module) {
/*! exports provided: name, version, description, main, types, scripts, repository, keywords, author, license, bugs, homepage, dependencies, devDependencies, default */
/***/ (function(module) {

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\"}}");
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\"}}");

/***/ }),

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

this.params = {
// 通用字段
Expand Down Expand Up @@ -13859,18 +13860,19 @@ var Tracker = /*#__PURE__*/function () {
}

var eventCode = getEventCode(this.params.name);
var formattedParams = formatParams(this.params);
var formattedParams = formatParams(this.params); // 兜底处理

if (this.params.delay === 0) {
if (!this.beacon) {
this.beacon = getBeacon(this.delay || 5000);
}

if (this.delay === 0) {
// 实时上报
this.beacon.onDirectUserAction(eventCode, formattedParams);
this.beacon && this.beacon.onDirectUserAction(eventCode, formattedParams);
} else {
// 周期性上报
this.beacon.onUserAction(eventCode, formattedParams);
} // 上报结束即销毁


this.destroy();
this.beacon && this.beacon.onUserAction(eventCode, formattedParams);
}
} // 生成子实例,与父所属一个链路,可用于分块上传内部流程上报单个分块操作

}, {
Expand All @@ -13884,16 +13886,9 @@ var Tracker = /*#__PURE__*/function () {
region: this.params.region,
fileKey: this.params.requestPath,
customId: this.params.customId,
delay: this.params.delay
delay: this.delay
});
return new Tracker(subParams);
} // 链路结束后销毁实例

}, {
key: "destroy",
value: function destroy() {
this.beacon = null;
this.params = {};
}
}]);

Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cos-js-sdk-v5",
"version": "1.4.7",
"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",
Expand Down
22 changes: 11 additions & 11 deletions src/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class Tracker {
const appid = bucket && bucket.substr(bucket.lastIndexOf('-') + 1) || '';
this.parent = parent;
this.deepTracker = deepTracker;
this.delay = delay;
// 上报用到的字段
this.params = {
// 通用字段
Expand Down Expand Up @@ -311,15 +312,19 @@ class Tracker {
}
const eventCode = getEventCode(this.params.name);
const formattedParams = formatParams(this.params);
if (this.params.delay === 0) {

// 兜底处理
if (!this.beacon) {
this.beacon = getBeacon(this.delay || 5000);
}

if (this.delay === 0) {
// 实时上报
this.beacon.onDirectUserAction(eventCode, formattedParams);
this.beacon && this.beacon.onDirectUserAction(eventCode, formattedParams);
} else {
// 周期性上报
this.beacon.onUserAction(eventCode, formattedParams);
this.beacon && this.beacon.onUserAction(eventCode, formattedParams);
}
// 上报结束即销毁
this.destroy();
}

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

// 链路结束后销毁实例
destroy() {
this.beacon = null;
this.params = {};
}
}

module.exports = Tracker;

0 comments on commit d4d85c6

Please sign in to comment.