@whitesev/pops 3.1.0 → 3.1.2
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 +6 -28
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +6 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +6 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +6 -28
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +6 -28
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +6 -28
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/PopsCore.d.ts +8 -16
- package/package.json +1 -1
- package/src/PopsCore.ts +4 -31
- package/src/components/panel/index.css +1 -0
- package/src/utils/PopsUtils.ts +4 -4
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
declare const PopsCoreDefaultEnv: {
|
|
2
2
|
document: Document;
|
|
3
|
-
window: Window;
|
|
3
|
+
window: Window & typeof globalThis;
|
|
4
4
|
globalThis: typeof globalThis;
|
|
5
|
-
self: typeof globalThis;
|
|
6
|
-
|
|
7
|
-
setInterval: Window["setInterval"];
|
|
8
|
-
clearTimeout: Window["clearTimeout"];
|
|
9
|
-
clearInterval: Window["clearInterval"];
|
|
10
|
-
}
|
|
5
|
+
self: Window & typeof globalThis;
|
|
6
|
+
};
|
|
11
7
|
declare const PopsCore: {
|
|
12
|
-
init(option?:
|
|
8
|
+
init(option?: typeof PopsCoreDefaultEnv): void;
|
|
13
9
|
readonly document: Document;
|
|
14
|
-
readonly window: Window;
|
|
10
|
+
readonly window: Window & typeof globalThis;
|
|
15
11
|
readonly globalThis: typeof globalThis;
|
|
16
|
-
readonly self: typeof globalThis;
|
|
17
|
-
readonly setTimeout: (handler: TimerHandler, timeout?: number, ...arguments: any[]) => number;
|
|
18
|
-
readonly setInterval: (handler: TimerHandler, timeout?: number, ...arguments: any[]) => number;
|
|
19
|
-
readonly clearTimeout: (id: number | undefined) => void;
|
|
20
|
-
readonly clearInterval: (id: number | undefined) => void;
|
|
12
|
+
readonly self: Window & typeof globalThis;
|
|
21
13
|
};
|
|
22
14
|
declare const OriginPrototype: {
|
|
23
15
|
Object: {
|
|
24
16
|
defineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
|
|
25
17
|
};
|
|
26
18
|
};
|
|
27
|
-
export {
|
|
19
|
+
export { PopsCore, OriginPrototype };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whitesev/pops",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "弹窗库,包含了alert、confirm、prompt、drawer、loading、iframe、rightClickMenu等组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/WhiteSevs/TamperMonkeyScript/tree/master/lib/pops#readme",
|
package/src/PopsCore.ts
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
document: Document;
|
|
3
|
-
window: Window;
|
|
4
|
-
globalThis: typeof globalThis;
|
|
5
|
-
self: typeof globalThis;
|
|
6
|
-
setTimeout: Window["setTimeout"];
|
|
7
|
-
setInterval: Window["setInterval"];
|
|
8
|
-
clearTimeout: Window["clearTimeout"];
|
|
9
|
-
clearInterval: Window["clearInterval"];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const PopsCoreDefaultEnv: PopsCoreOption = {
|
|
1
|
+
const PopsCoreDefaultEnv = {
|
|
13
2
|
document: document,
|
|
14
3
|
window: window,
|
|
15
4
|
globalThis: globalThis,
|
|
16
5
|
self: self,
|
|
17
|
-
setTimeout: globalThis.setTimeout.bind(globalThis),
|
|
18
|
-
setInterval: globalThis.setInterval.bind(globalThis),
|
|
19
|
-
clearTimeout: globalThis.clearTimeout.bind(globalThis),
|
|
20
|
-
clearInterval: globalThis.clearInterval.bind(globalThis),
|
|
21
6
|
};
|
|
22
7
|
|
|
23
|
-
const PopsCoreEnv
|
|
8
|
+
const PopsCoreEnv = Object.assign({}, PopsCoreDefaultEnv);
|
|
24
9
|
|
|
25
10
|
const PopsCore = {
|
|
26
|
-
init(option?:
|
|
11
|
+
init(option?: typeof PopsCoreDefaultEnv) {
|
|
27
12
|
if (!option) {
|
|
28
13
|
option = Object.assign({}, PopsCoreDefaultEnv);
|
|
29
14
|
}
|
|
@@ -41,18 +26,6 @@ const PopsCore = {
|
|
|
41
26
|
get self() {
|
|
42
27
|
return PopsCoreEnv.self;
|
|
43
28
|
},
|
|
44
|
-
get setTimeout() {
|
|
45
|
-
return PopsCoreEnv.setTimeout;
|
|
46
|
-
},
|
|
47
|
-
get setInterval() {
|
|
48
|
-
return PopsCoreEnv.setInterval;
|
|
49
|
-
},
|
|
50
|
-
get clearTimeout() {
|
|
51
|
-
return PopsCoreEnv.clearTimeout;
|
|
52
|
-
},
|
|
53
|
-
get clearInterval() {
|
|
54
|
-
return PopsCoreEnv.clearInterval;
|
|
55
|
-
},
|
|
56
29
|
};
|
|
57
30
|
|
|
58
31
|
const OriginPrototype = {
|
|
@@ -61,4 +34,4 @@ const OriginPrototype = {
|
|
|
61
34
|
},
|
|
62
35
|
};
|
|
63
36
|
|
|
64
|
-
export {
|
|
37
|
+
export { PopsCore, OriginPrototype };
|
package/src/utils/PopsUtils.ts
CHANGED
|
@@ -359,7 +359,7 @@ class PopsUtils {
|
|
|
359
359
|
try {
|
|
360
360
|
return WorkerSetTimeout(callback, timeout);
|
|
361
361
|
} catch {
|
|
362
|
-
return
|
|
362
|
+
return setTimeout(callback, timeout);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
/**
|
|
@@ -373,7 +373,7 @@ class PopsUtils {
|
|
|
373
373
|
} catch {
|
|
374
374
|
// TODO
|
|
375
375
|
} finally {
|
|
376
|
-
|
|
376
|
+
clearTimeout(timeId);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
/**
|
|
@@ -383,7 +383,7 @@ class PopsUtils {
|
|
|
383
383
|
try {
|
|
384
384
|
return WorkerSetInterval(callback, timeout);
|
|
385
385
|
} catch {
|
|
386
|
-
return
|
|
386
|
+
return setInterval(callback, timeout);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
@@ -397,7 +397,7 @@ class PopsUtils {
|
|
|
397
397
|
} catch {
|
|
398
398
|
// 忽略
|
|
399
399
|
} finally {
|
|
400
|
-
|
|
400
|
+
clearInterval(timeId);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
/**
|