@whitesev/utils 1.0.8 → 1.1.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 +20 -17
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +20 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +20 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +20 -17
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +20 -17
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +20 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Event.d.ts +156 -0
- package/dist/src/Httpx.d.ts +1 -1
- package/dist/src/Log.d.ts +4 -3
- package/dist/src/{index.d.ts → Utils.d.ts} +12 -166
- package/dist/src/UtilsGMMenu.d.ts +4 -4
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/Dictionary.ts +1 -1
- package/src/Event.ts +189 -0
- package/src/GBKEncoder.ts +1 -1
- package/src/Httpx.ts +1 -1
- package/src/LockFunction.ts +1 -1
- package/src/Log.ts +28 -25
- package/src/Progress.ts +1 -1
- package/src/{tryCatch.ts → TryCatch.ts} +1 -1
- package/src/{index.ts → Utils.ts} +16 -205
- package/src/UtilsGMCookie.ts +1 -1
- package/src/UtilsGMMenu.ts +1 -1
- package/src/indexedDB.ts +2 -4
- /package/dist/src/{tryCatch.d.ts → TryCatch.d.ts} +0 -0
package/src/Log.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyObject } from "
|
|
1
|
+
import type { AnyObject } from "./Utils";
|
|
2
2
|
|
|
3
3
|
/** Utils.Log的初始化配置 */
|
|
4
4
|
declare interface UtilsLogOptions {
|
|
@@ -21,11 +21,15 @@ declare interface UtilsLogOptions {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
class Log {
|
|
24
|
-
/**
|
|
24
|
+
/** 是否禁用输出的flag */
|
|
25
25
|
#disable: boolean = false;
|
|
26
|
-
|
|
26
|
+
/** 前面的TAG标志 */
|
|
27
|
+
tag: string = "Utils.Log";
|
|
28
|
+
/* 使用的console函数 */
|
|
27
29
|
#console: Console = null as any;
|
|
30
|
+
/* 当前输出的数量 */
|
|
28
31
|
#logCount = 0;
|
|
32
|
+
/* 配置 */
|
|
29
33
|
#details: UtilsLogOptions = {
|
|
30
34
|
tag: true,
|
|
31
35
|
successColor: "#0000FF",
|
|
@@ -36,10 +40,6 @@ class Log {
|
|
|
36
40
|
autoClearConsole: false,
|
|
37
41
|
logMaxCount: 999,
|
|
38
42
|
};
|
|
39
|
-
/**
|
|
40
|
-
* 待恢复的函数或对象
|
|
41
|
-
*/
|
|
42
|
-
#recoveryList = [];
|
|
43
43
|
#msgColorDetails = [
|
|
44
44
|
"font-weight: bold; color: cornflowerblue",
|
|
45
45
|
"font-weight: bold; color: cornflowerblue",
|
|
@@ -47,22 +47,27 @@ class Log {
|
|
|
47
47
|
"font-weight: bold; color: cornflowerblue",
|
|
48
48
|
];
|
|
49
49
|
/**
|
|
50
|
-
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}}
|
|
50
|
+
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}},或者直接是一个字符串
|
|
51
51
|
* @param console 可指定console对象为unsafeWindow下的console或者是油猴window下的console
|
|
52
52
|
*/
|
|
53
53
|
constructor(
|
|
54
|
-
_GM_info_
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
console: Console = global.console
|
|
54
|
+
_GM_info_?:
|
|
55
|
+
| {
|
|
56
|
+
script: {
|
|
57
|
+
name: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
| string,
|
|
61
|
+
console: Console = globalThis.console
|
|
64
62
|
) {
|
|
65
|
-
|
|
63
|
+
if (typeof _GM_info_ === "string") {
|
|
64
|
+
this.tag = _GM_info_;
|
|
65
|
+
} else if (
|
|
66
|
+
typeof _GM_info_ === "object" &&
|
|
67
|
+
typeof _GM_info_?.script?.name === "string"
|
|
68
|
+
) {
|
|
69
|
+
this.tag = _GM_info_.script.name;
|
|
70
|
+
}
|
|
66
71
|
this.#console = console;
|
|
67
72
|
}
|
|
68
73
|
|
|
@@ -87,6 +92,7 @@ class Log {
|
|
|
87
92
|
if (stackFunctionNamePositionMatch == null) {
|
|
88
93
|
continue;
|
|
89
94
|
}
|
|
95
|
+
/* 获取最后一个,因为第一个是包含了at */
|
|
90
96
|
let stackFunctionName =
|
|
91
97
|
stackFunctionNameMatch[stackFunctionNameMatch.length - 1];
|
|
92
98
|
let stackFunctionNamePosition =
|
|
@@ -96,10 +102,7 @@ class Log {
|
|
|
96
102
|
if (
|
|
97
103
|
stackFunctionName === "" ||
|
|
98
104
|
stackFunctionName.match(
|
|
99
|
-
|
|
100
|
-
"(^Utils.Log.|.<anonymous>$|^Function.each|^NodeList.forEach|^k.fn.init.each)",
|
|
101
|
-
"g"
|
|
102
|
-
)
|
|
105
|
+
/^(Utils\.|)Log(\.|)|.<anonymous>$|^Function.each|^NodeList.forEach|^k.fn.init.each/g
|
|
103
106
|
)
|
|
104
107
|
) {
|
|
105
108
|
continue;
|
|
@@ -144,7 +147,7 @@ class Log {
|
|
|
144
147
|
* @param otherStyle 其它CSS
|
|
145
148
|
*/
|
|
146
149
|
private printContent(msg: any, color: string, otherStyle?: string) {
|
|
147
|
-
this.checkClearConsole
|
|
150
|
+
this.checkClearConsole();
|
|
148
151
|
otherStyle = otherStyle || "";
|
|
149
152
|
let stackSplit = new Error()!.stack!.split("\n");
|
|
150
153
|
stackSplit.splice(0, 2);
|
|
@@ -244,7 +247,7 @@ class Log {
|
|
|
244
247
|
*/
|
|
245
248
|
table(msg: AnyObject[], color = this.#details.infoColor, otherStyle = "") {
|
|
246
249
|
if (this.#disable) return;
|
|
247
|
-
this.checkClearConsole
|
|
250
|
+
this.checkClearConsole();
|
|
248
251
|
let stack = new Error()!.stack!.split("\n");
|
|
249
252
|
stack.splice(0, 1);
|
|
250
253
|
let errorStackParse = this.parseErrorStack(stack);
|
package/src/Progress.ts
CHANGED
|
@@ -11,8 +11,9 @@ import { indexedDB } from "./indexedDB";
|
|
|
11
11
|
import { LockFunction } from "./LockFunction";
|
|
12
12
|
import { Log } from "./Log";
|
|
13
13
|
import { Progress } from "./Progress";
|
|
14
|
-
import { TryCatch } from "./
|
|
14
|
+
import { TryCatch } from "./TryCatch";
|
|
15
15
|
import { UtilsDictionary } from "./Dictionary";
|
|
16
|
+
import type { DOMUtils_EventType } from "./Event";
|
|
16
17
|
|
|
17
18
|
export declare var unsafeWindow: Window & typeof globalThis;
|
|
18
19
|
|
|
@@ -33,8 +34,8 @@ export type ArgsType<T extends JSTypeNames[]> = {
|
|
|
33
34
|
[I in keyof T]: JSTypeMap[T[I]];
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
export declare interface
|
|
37
|
-
[key: string]: V |
|
|
37
|
+
export declare interface UtilsOwnObject<V extends any> {
|
|
38
|
+
[key: string]: V | UtilsOwnObject<V>;
|
|
38
39
|
}
|
|
39
40
|
export declare interface AnyObject {
|
|
40
41
|
[key: string]: any | AnyObject;
|
|
@@ -64,199 +65,9 @@ export declare interface Vue2Context extends AnyObject {
|
|
|
64
65
|
$el: Element;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
/**
|
|
68
|
-
* 鼠标事件
|
|
69
|
-
* + https://blog.csdn.net/weixin_68658847/article/details/126939879
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
declare interface DOMUtils_MouseEvent {
|
|
73
|
-
click: MouseEvent | PointerEvent;
|
|
74
|
-
contextmenu: MouseEvent | PointerEvent;
|
|
75
|
-
dblclick: MouseEvent | PointerEvent;
|
|
76
|
-
mousedown: MouseEvent | PointerEvent;
|
|
77
|
-
mouseenter: MouseEvent | PointerEvent;
|
|
78
|
-
mouseleave: MouseEvent | PointerEvent;
|
|
79
|
-
mousemove: MouseEvent | PointerEvent;
|
|
80
|
-
mouseover: MouseEvent | PointerEvent;
|
|
81
|
-
mouseout: MouseEvent | PointerEvent;
|
|
82
|
-
mouseup: MouseEvent | PointerEvent;
|
|
83
|
-
}
|
|
84
|
-
declare type DOMUtils_MouseEventType = keyof DOMUtils_MouseEvent;
|
|
85
|
-
/**
|
|
86
|
-
* 鼠标事件
|
|
87
|
-
*/
|
|
88
|
-
declare interface DOMUtils_KeyboardEvent {
|
|
89
|
-
keydown: KeyboardEvent;
|
|
90
|
-
keypress: KeyboardEvent;
|
|
91
|
-
keyup: KeyboardEvent;
|
|
92
|
-
}
|
|
93
|
-
declare type DOMUtils_KeyboardEventType = keyof DOMUtils_KeyboardEvent;
|
|
94
|
-
/**
|
|
95
|
-
* 框架/对象事件
|
|
96
|
-
*/
|
|
97
|
-
declare interface DOMUtils_Frame_Object_Event {
|
|
98
|
-
abort: Event;
|
|
99
|
-
beforeunload: Event;
|
|
100
|
-
error: Event;
|
|
101
|
-
hashchange: Event;
|
|
102
|
-
load: Event;
|
|
103
|
-
pageshow: Event;
|
|
104
|
-
pagehide: Event;
|
|
105
|
-
resize: Event;
|
|
106
|
-
scroll: Event;
|
|
107
|
-
unload: Event;
|
|
108
|
-
}
|
|
109
|
-
declare type DOMUtils_Frame_Object_EventType =
|
|
110
|
-
keyof DOMUtils_Frame_Object_Event;
|
|
111
|
-
/**
|
|
112
|
-
* 表单事件
|
|
113
|
-
*/
|
|
114
|
-
declare interface DOMUtils_FormEvent {
|
|
115
|
-
blur: Event;
|
|
116
|
-
change: Event;
|
|
117
|
-
focus: Event;
|
|
118
|
-
focusin: Event;
|
|
119
|
-
focusout: Event;
|
|
120
|
-
input: Event;
|
|
121
|
-
reset: Event;
|
|
122
|
-
search: Event;
|
|
123
|
-
}
|
|
124
|
-
declare type DOMUtils_FormEventType = keyof DOMUtils_FormEvent;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* 剪贴板事件
|
|
128
|
-
*/
|
|
129
|
-
declare interface DOMUtils_ClipboardEvent {
|
|
130
|
-
copy: ClipboardEvent;
|
|
131
|
-
cut: ClipboardEvent;
|
|
132
|
-
paste: ClipboardEvent;
|
|
133
|
-
}
|
|
134
|
-
declare type DOMUtils_ClipboardEventType = keyof DOMUtils_ClipboardEvent;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* 打印事件
|
|
138
|
-
*/
|
|
139
|
-
declare interface DOMUtils_PrintEvent {
|
|
140
|
-
afterprint: Event;
|
|
141
|
-
beforeprint: Event;
|
|
142
|
-
}
|
|
143
|
-
declare type DOMUtils_PrintEventType = keyof DOMUtils_PrintEvent;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 拖动事件
|
|
147
|
-
*/
|
|
148
|
-
declare interface DOMUtils_DragEvent {
|
|
149
|
-
drag: DragEvent;
|
|
150
|
-
dragend: DragEvent;
|
|
151
|
-
dragenter: DragEvent;
|
|
152
|
-
dragleave: DragEvent;
|
|
153
|
-
dragover: DragEvent;
|
|
154
|
-
dragstart: DragEvent;
|
|
155
|
-
drop: DragEvent;
|
|
156
|
-
}
|
|
157
|
-
declare type DOMUtils_DragEventType = keyof DOMUtils_DragEvent;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* 多媒体(Media)事件
|
|
161
|
-
*/
|
|
162
|
-
declare interface DOMUtils_MediaEvent {
|
|
163
|
-
abort: Event;
|
|
164
|
-
canplay: Event;
|
|
165
|
-
canplaythrough: Event;
|
|
166
|
-
durationchange: Event;
|
|
167
|
-
emptied: Event;
|
|
168
|
-
ended: Event;
|
|
169
|
-
error: Event;
|
|
170
|
-
loadeddata: Event;
|
|
171
|
-
loadedmetadata: Event;
|
|
172
|
-
loadstart: Event;
|
|
173
|
-
pause: Event;
|
|
174
|
-
play: Event;
|
|
175
|
-
playing: Event;
|
|
176
|
-
progress: Event;
|
|
177
|
-
ratechange: Event;
|
|
178
|
-
seeked: Event;
|
|
179
|
-
seeking: Event;
|
|
180
|
-
stalled: Event;
|
|
181
|
-
suspend: Event;
|
|
182
|
-
timeupdate: Event;
|
|
183
|
-
volumechange: Event;
|
|
184
|
-
waiting: Event;
|
|
185
|
-
}
|
|
186
|
-
declare type DOMUtils_MediaEventType = keyof DOMUtils_MediaEvent;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* 动画事件
|
|
190
|
-
*/
|
|
191
|
-
declare interface DOMUtils_AnimationEvent {
|
|
192
|
-
animationend: AnimationEvent;
|
|
193
|
-
animationiteration: AnimationEvent;
|
|
194
|
-
animationstart: AnimationEvent;
|
|
195
|
-
}
|
|
196
|
-
declare type DOMUtils_AnimationEventType = keyof DOMUtils_AnimationEvent;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* 过渡事件
|
|
200
|
-
*/
|
|
201
|
-
declare interface DOMUtils_TransitionEvent {
|
|
202
|
-
transitionend: TransitionEvent;
|
|
203
|
-
}
|
|
204
|
-
declare type DOMUtils_TransitionEventType = keyof DOMUtils_TransitionEvent;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* 触摸事件
|
|
208
|
-
*/
|
|
209
|
-
declare interface DOMUtils_TouchEvent {
|
|
210
|
-
touchstart: TouchEvent;
|
|
211
|
-
touchmove: TouchEvent;
|
|
212
|
-
touchend: TouchEvent;
|
|
213
|
-
touchcancel: TouchEvent;
|
|
214
|
-
touchenter: TouchEvent;
|
|
215
|
-
touchleave: TouchEvent;
|
|
216
|
-
}
|
|
217
|
-
declare type DOMUtils_TouchEventType = keyof DOMUtils_TouchEvent;
|
|
218
|
-
/**
|
|
219
|
-
* 其它事件
|
|
220
|
-
*/
|
|
221
|
-
declare interface DOMUtils_OtherEvent {
|
|
222
|
-
message: Event;
|
|
223
|
-
online: Event;
|
|
224
|
-
offline: Event;
|
|
225
|
-
popstate: Event;
|
|
226
|
-
show: Event;
|
|
227
|
-
storage: Event;
|
|
228
|
-
toggle: Event;
|
|
229
|
-
wheel: Event;
|
|
230
|
-
propertychange: Event;
|
|
231
|
-
fullscreenchange: Event;
|
|
232
|
-
DOMContentLoaded: Event;
|
|
233
|
-
}
|
|
234
|
-
declare type DOMUtils_OtherEventType = keyof DOMUtils_OtherEvent;
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* 全部事件
|
|
238
|
-
*/
|
|
239
|
-
declare type DOMUtils_Event = DOMUtils_MouseEvent &
|
|
240
|
-
DOMUtils_KeyboardEvent &
|
|
241
|
-
DOMUtils_Frame_Object_Event &
|
|
242
|
-
DOMUtils_FormEvent &
|
|
243
|
-
DOMUtils_ClipboardEvent &
|
|
244
|
-
DOMUtils_PrintEvent &
|
|
245
|
-
DOMUtils_DragEvent &
|
|
246
|
-
DOMUtils_MediaEvent &
|
|
247
|
-
DOMUtils_AnimationEvent &
|
|
248
|
-
DOMUtils_TransitionEvent &
|
|
249
|
-
DOMUtils_TouchEvent &
|
|
250
|
-
DOMUtils_OtherEvent;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* 事件类型
|
|
254
|
-
*/
|
|
255
|
-
declare type DOMUtils_EventType = keyof DOMUtils_Event;
|
|
256
|
-
|
|
257
68
|
class Utils {
|
|
258
69
|
/** 版本号 */
|
|
259
|
-
version = "2024.5.
|
|
70
|
+
version = "2024.5.28";
|
|
260
71
|
|
|
261
72
|
/**
|
|
262
73
|
* 在页面中增加style元素,如果html节点存在子节点,添加子节点第一个,反之,添加到html节点的子节点最后一个
|
|
@@ -697,7 +508,7 @@ class Utils {
|
|
|
697
508
|
dispatchEvent(
|
|
698
509
|
element: HTMLElement | Document,
|
|
699
510
|
eventName: DOMUtils_EventType | DOMUtils_EventType[],
|
|
700
|
-
details?:
|
|
511
|
+
details?: UtilsOwnObject<any>
|
|
701
512
|
): void;
|
|
702
513
|
/**
|
|
703
514
|
* 主动触发事件
|
|
@@ -712,12 +523,12 @@ class Utils {
|
|
|
712
523
|
dispatchEvent(
|
|
713
524
|
element: HTMLElement | Document,
|
|
714
525
|
eventName: string,
|
|
715
|
-
details?:
|
|
526
|
+
details?: UtilsOwnObject<any>
|
|
716
527
|
): void;
|
|
717
528
|
dispatchEvent(
|
|
718
529
|
element: HTMLElement | Document,
|
|
719
530
|
eventName: DOMUtils_EventType | DOMUtils_EventType[] | string,
|
|
720
|
-
details?:
|
|
531
|
+
details?: UtilsOwnObject<any>
|
|
721
532
|
) {
|
|
722
533
|
let eventNameList: string[] = [];
|
|
723
534
|
if (typeof eventName === "string") {
|
|
@@ -926,7 +737,7 @@ class Utils {
|
|
|
926
737
|
}
|
|
927
738
|
let result = 0;
|
|
928
739
|
let resultType = "KB";
|
|
929
|
-
let sizeData:
|
|
740
|
+
let sizeData: UtilsOwnObject<number> = {};
|
|
930
741
|
sizeData.B = 1;
|
|
931
742
|
sizeData.KB = 1024;
|
|
932
743
|
sizeData.MB = sizeData.KB * sizeData.KB;
|
|
@@ -1341,7 +1152,7 @@ class Utils {
|
|
|
1341
1152
|
* > 456
|
|
1342
1153
|
*/
|
|
1343
1154
|
getMaxValue(
|
|
1344
|
-
val:
|
|
1155
|
+
val: UtilsOwnObject<number>,
|
|
1345
1156
|
handler: (key: any, value: any) => number
|
|
1346
1157
|
): number;
|
|
1347
1158
|
/**
|
|
@@ -1431,7 +1242,7 @@ class Utils {
|
|
|
1431
1242
|
* > 123
|
|
1432
1243
|
*/
|
|
1433
1244
|
getMinValue(
|
|
1434
|
-
val:
|
|
1245
|
+
val: UtilsOwnObject<number>,
|
|
1435
1246
|
handler: (key: any, value: any) => number
|
|
1436
1247
|
): number;
|
|
1437
1248
|
/**
|
|
@@ -1441,7 +1252,7 @@ class Utils {
|
|
|
1441
1252
|
* > 0
|
|
1442
1253
|
*/
|
|
1443
1254
|
getMinValue(
|
|
1444
|
-
val:
|
|
1255
|
+
val: UtilsOwnObject<number>[],
|
|
1445
1256
|
handler: (index: number, value: any) => number
|
|
1446
1257
|
): number;
|
|
1447
1258
|
getMinValue(...args: any[]): number {
|
|
@@ -1528,7 +1339,7 @@ class Utils {
|
|
|
1528
1339
|
* Utils.getRandomValue({1:"结果1",2:"结果2",3:"结果3"}})
|
|
1529
1340
|
* > 结果2
|
|
1530
1341
|
*/
|
|
1531
|
-
getRandomValue<T extends any>(val: T[] |
|
|
1342
|
+
getRandomValue<T extends any>(val: T[] | UtilsOwnObject<T>): T;
|
|
1532
1343
|
/**
|
|
1533
1344
|
* 获取两个数之间随机值
|
|
1534
1345
|
* @example
|
|
@@ -1543,8 +1354,8 @@ class Utils {
|
|
|
1543
1354
|
* > {1: 1}
|
|
1544
1355
|
*/
|
|
1545
1356
|
getRandomValue<T extends any>(
|
|
1546
|
-
val_1:
|
|
1547
|
-
val_2:
|
|
1357
|
+
val_1: UtilsOwnObject<T>,
|
|
1358
|
+
val_2: UtilsOwnObject<T>
|
|
1548
1359
|
): T;
|
|
1549
1360
|
getRandomValue(...args: any[]): any {
|
|
1550
1361
|
let result = [...args];
|
|
@@ -2174,7 +1985,7 @@ class Utils {
|
|
|
2174
1985
|
return false;
|
|
2175
1986
|
}
|
|
2176
1987
|
targetStr = targetStr.toLowerCase();
|
|
2177
|
-
const targetCharMap:
|
|
1988
|
+
const targetCharMap: UtilsOwnObject<string> = {};
|
|
2178
1989
|
let targetStrLength = 0;
|
|
2179
1990
|
for (const char of targetStr) {
|
|
2180
1991
|
if (Reflect.has(targetCharMap, char)) {
|
package/src/UtilsGMCookie.ts
CHANGED
package/src/UtilsGMMenu.ts
CHANGED
package/src/indexedDB.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { AnyObject } from ".";
|
|
2
|
-
|
|
3
1
|
declare interface UtilsIDBOpenErrorResult {
|
|
4
2
|
code: number;
|
|
5
3
|
msg: string;
|
|
@@ -104,14 +102,14 @@ class indexedDB {
|
|
|
104
102
|
};
|
|
105
103
|
request.onsuccess = function (event: Event) {
|
|
106
104
|
if (!that.#db[dbName]) {
|
|
107
|
-
|
|
105
|
+
let target = event.target as IDBRequest;
|
|
108
106
|
that.#db[dbName] = target.result;
|
|
109
107
|
}
|
|
110
108
|
let store = that.createStore(dbName);
|
|
111
109
|
callback(store, true);
|
|
112
110
|
};
|
|
113
111
|
request.onupgradeneeded = function (event: Event) {
|
|
114
|
-
|
|
112
|
+
let target = event.target as IDBRequest;
|
|
115
113
|
that.#db[dbName] = target.result;
|
|
116
114
|
let store = that.#db[dbName].createObjectStore(that.#storeName, {
|
|
117
115
|
keyPath: "key",
|
|
File without changes
|