@whitesev/utils 1.9.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +35 -18
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +35 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +35 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +35 -18
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +35 -18
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +35 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.amd.js
CHANGED
|
@@ -207,6 +207,7 @@ define((function () { 'use strict';
|
|
|
207
207
|
decode(str) {
|
|
208
208
|
var GBKMatcher = /%[0-9A-F]{2}%[0-9A-F]{2}/;
|
|
209
209
|
var UTFMatcher = /%[0-9A-F]{2}/;
|
|
210
|
+
// @ts-ignore
|
|
210
211
|
var utf = true;
|
|
211
212
|
let that = this;
|
|
212
213
|
while (utf) {
|
|
@@ -1167,6 +1168,7 @@ define((function () { 'use strict';
|
|
|
1167
1168
|
let defaultEnable = Boolean(this.getLocalMenuData(menuLocalDataItemKey, menuOption.enable));
|
|
1168
1169
|
/** 油猴菜单上显示的文本 */
|
|
1169
1170
|
let showText = menuOption.showText(menuOption.text, defaultEnable);
|
|
1171
|
+
// @ts-ignore
|
|
1170
1172
|
({
|
|
1171
1173
|
/**
|
|
1172
1174
|
* 菜单的id
|
|
@@ -2539,6 +2541,7 @@ define((function () { 'use strict';
|
|
|
2539
2541
|
#storeName;
|
|
2540
2542
|
#dbVersion;
|
|
2541
2543
|
/* websql的版本号,由于ios的问题,版本号的写法不一样 */
|
|
2544
|
+
// @ts-ignore
|
|
2542
2545
|
#slqVersion = "1";
|
|
2543
2546
|
/* 监听IndexDB */
|
|
2544
2547
|
#indexedDB = UtilsCore.window.indexedDB ||
|
|
@@ -2547,6 +2550,7 @@ define((function () { 'use strict';
|
|
|
2547
2550
|
UtilsCore.window.msIndexedDB;
|
|
2548
2551
|
/* 缓存数据库,避免同一个页面重复创建和销毁 */
|
|
2549
2552
|
#db = {};
|
|
2553
|
+
// @ts-ignore
|
|
2550
2554
|
#store = null;
|
|
2551
2555
|
#errorCode = {
|
|
2552
2556
|
/* 错误码 */
|
|
@@ -2661,6 +2665,7 @@ define((function () { 'use strict';
|
|
|
2661
2665
|
let request = idbStore.put(inData);
|
|
2662
2666
|
request.onsuccess = function (event) {
|
|
2663
2667
|
/* 保存成功有success 字段 */
|
|
2668
|
+
// @ts-ignore
|
|
2664
2669
|
event.target;
|
|
2665
2670
|
resolve({
|
|
2666
2671
|
success: true,
|
|
@@ -2670,6 +2675,7 @@ define((function () { 'use strict';
|
|
|
2670
2675
|
});
|
|
2671
2676
|
};
|
|
2672
2677
|
request.onerror = function (event) {
|
|
2678
|
+
// @ts-ignore
|
|
2673
2679
|
event.target;
|
|
2674
2680
|
resolve({
|
|
2675
2681
|
success: false,
|
|
@@ -2731,6 +2737,7 @@ define((function () { 'use strict';
|
|
|
2731
2737
|
}
|
|
2732
2738
|
};
|
|
2733
2739
|
request.onerror = function (event) {
|
|
2740
|
+
// @ts-ignore
|
|
2734
2741
|
event.target;
|
|
2735
2742
|
resolve({
|
|
2736
2743
|
success: false,
|
|
@@ -2788,6 +2795,7 @@ define((function () { 'use strict';
|
|
|
2788
2795
|
});
|
|
2789
2796
|
};
|
|
2790
2797
|
request.onerror = function (event) {
|
|
2798
|
+
// @ts-ignore
|
|
2791
2799
|
event.target;
|
|
2792
2800
|
resolve({
|
|
2793
2801
|
success: false,
|
|
@@ -2842,6 +2850,7 @@ define((function () { 'use strict';
|
|
|
2842
2850
|
}
|
|
2843
2851
|
};
|
|
2844
2852
|
request.onerror = function (event) {
|
|
2853
|
+
// @ts-ignore
|
|
2845
2854
|
event.target;
|
|
2846
2855
|
resolve({
|
|
2847
2856
|
success: false,
|
|
@@ -5136,8 +5145,11 @@ define((function () { 'use strict';
|
|
|
5136
5145
|
let windowMutationObserver = UtilsCore.window.MutationObserver ||
|
|
5137
5146
|
UtilsCore.window.webkitMutationObserver ||
|
|
5138
5147
|
UtilsCore.window.MozMutationObserver;
|
|
5148
|
+
// 观察者对象
|
|
5139
5149
|
let mutationObserver = new windowMutationObserver(function (mutations, observer) {
|
|
5140
|
-
observer_config
|
|
5150
|
+
if (typeof observer_config.callback === "function") {
|
|
5151
|
+
observer_config.callback(mutations, observer);
|
|
5152
|
+
}
|
|
5141
5153
|
});
|
|
5142
5154
|
if (Array.isArray(target) || target instanceof NodeList) {
|
|
5143
5155
|
// 传入的是数组或者元素数组
|
|
@@ -5156,7 +5168,9 @@ define((function () { 'use strict';
|
|
|
5156
5168
|
}
|
|
5157
5169
|
if (observer_config.immediate) {
|
|
5158
5170
|
/* 主动触发一次 */
|
|
5159
|
-
observer_config.callback
|
|
5171
|
+
if (typeof observer_config.callback === "function") {
|
|
5172
|
+
observer_config.callback([], mutationObserver);
|
|
5173
|
+
}
|
|
5160
5174
|
}
|
|
5161
5175
|
return mutationObserver;
|
|
5162
5176
|
}
|
|
@@ -5404,6 +5418,7 @@ define((function () { 'use strict';
|
|
|
5404
5418
|
EventTarget.prototype.addEventListener = function (...args) {
|
|
5405
5419
|
let type = args[0];
|
|
5406
5420
|
let callback = args[1];
|
|
5421
|
+
// @ts-ignore
|
|
5407
5422
|
args[2];
|
|
5408
5423
|
if (filter(type)) {
|
|
5409
5424
|
if (typeof callback === "function") {
|
|
@@ -5497,6 +5512,7 @@ define((function () { 'use strict';
|
|
|
5497
5512
|
}
|
|
5498
5513
|
async init() {
|
|
5499
5514
|
let copyStatus = false;
|
|
5515
|
+
// @ts-ignore
|
|
5500
5516
|
await this.requestClipboardPermission();
|
|
5501
5517
|
if (this.hasClipboard() &&
|
|
5502
5518
|
(this.hasClipboardWrite() || this.hasClipboardWriteText())) {
|
|
@@ -6030,12 +6046,7 @@ define((function () { 'use strict';
|
|
|
6030
6046
|
return parent.querySelector(selector);
|
|
6031
6047
|
}
|
|
6032
6048
|
}
|
|
6033
|
-
|
|
6034
|
-
if (node) {
|
|
6035
|
-
resolve(node);
|
|
6036
|
-
return;
|
|
6037
|
-
}
|
|
6038
|
-
let observer = that.mutationObserver(parent, {
|
|
6049
|
+
var observer = that.mutationObserver(parent, {
|
|
6039
6050
|
config: {
|
|
6040
6051
|
subtree: true,
|
|
6041
6052
|
childList: true,
|
|
@@ -6045,16 +6056,21 @@ define((function () { 'use strict';
|
|
|
6045
6056
|
let node = getNode();
|
|
6046
6057
|
if (node) {
|
|
6047
6058
|
// 取消观察器
|
|
6048
|
-
observer
|
|
6059
|
+
if (typeof observer?.disconnect === "function") {
|
|
6060
|
+
observer.disconnect();
|
|
6061
|
+
}
|
|
6049
6062
|
resolve(node);
|
|
6050
6063
|
return;
|
|
6051
6064
|
}
|
|
6052
6065
|
},
|
|
6066
|
+
immediate: true,
|
|
6053
6067
|
});
|
|
6054
6068
|
if (timeout > 0) {
|
|
6055
6069
|
setTimeout(() => {
|
|
6056
6070
|
// 取消观察器
|
|
6057
|
-
observer
|
|
6071
|
+
if (typeof observer?.disconnect === "function") {
|
|
6072
|
+
observer.disconnect();
|
|
6073
|
+
}
|
|
6058
6074
|
resolve(null);
|
|
6059
6075
|
}, timeout);
|
|
6060
6076
|
}
|
|
@@ -6188,12 +6204,7 @@ define((function () { 'use strict';
|
|
|
6188
6204
|
}
|
|
6189
6205
|
}
|
|
6190
6206
|
}
|
|
6191
|
-
|
|
6192
|
-
if (nodeList) {
|
|
6193
|
-
resolve(nodeList);
|
|
6194
|
-
return;
|
|
6195
|
-
}
|
|
6196
|
-
let observer = that.mutationObserver(parent, {
|
|
6207
|
+
var observer = that.mutationObserver(parent, {
|
|
6197
6208
|
config: {
|
|
6198
6209
|
subtree: true,
|
|
6199
6210
|
childList: true,
|
|
@@ -6203,16 +6214,22 @@ define((function () { 'use strict';
|
|
|
6203
6214
|
let node = getNodeList();
|
|
6204
6215
|
if (node) {
|
|
6205
6216
|
// 取消观察器
|
|
6206
|
-
|
|
6217
|
+
try {
|
|
6218
|
+
observer.disconnect();
|
|
6219
|
+
}
|
|
6220
|
+
catch (error) { }
|
|
6207
6221
|
resolve(node);
|
|
6208
6222
|
return;
|
|
6209
6223
|
}
|
|
6210
6224
|
},
|
|
6225
|
+
immediate: true,
|
|
6211
6226
|
});
|
|
6212
6227
|
if (timeout > 0) {
|
|
6213
6228
|
setTimeout(() => {
|
|
6214
6229
|
// 取消观察器
|
|
6215
|
-
observer
|
|
6230
|
+
if (typeof observer?.disconnect === "function") {
|
|
6231
|
+
observer.disconnect();
|
|
6232
|
+
}
|
|
6216
6233
|
resolve(null);
|
|
6217
6234
|
}, timeout);
|
|
6218
6235
|
}
|