@whitesev/pops 2.3.5 → 2.3.6
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 +26 -4
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +26 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +26 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +26 -4
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +26 -4
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +26 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/PopsCore.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -180,9 +180,19 @@ const PopsCoreDefaultEnv = {
|
|
|
180
180
|
window: window,
|
|
181
181
|
globalThis: globalThis,
|
|
182
182
|
self: self,
|
|
183
|
+
setTimeout: globalThis.setTimeout.bind(globalThis),
|
|
184
|
+
setInterval: globalThis.setInterval.bind(globalThis),
|
|
185
|
+
clearTimeout: globalThis.clearTimeout.bind(globalThis),
|
|
186
|
+
clearInterval: globalThis.clearInterval.bind(globalThis),
|
|
183
187
|
};
|
|
184
188
|
const PopsCoreEnv = Object.assign({}, PopsCoreDefaultEnv);
|
|
185
189
|
const PopsCore = {
|
|
190
|
+
init(option) {
|
|
191
|
+
if (!option) {
|
|
192
|
+
option = Object.assign({}, PopsCoreDefaultEnv);
|
|
193
|
+
}
|
|
194
|
+
Object.assign(PopsCoreEnv, option);
|
|
195
|
+
},
|
|
186
196
|
get document() {
|
|
187
197
|
return PopsCoreEnv.document;
|
|
188
198
|
},
|
|
@@ -195,6 +205,18 @@ const PopsCore = {
|
|
|
195
205
|
get self() {
|
|
196
206
|
return PopsCoreEnv.self;
|
|
197
207
|
},
|
|
208
|
+
get setTimeout() {
|
|
209
|
+
return PopsCoreEnv.setTimeout;
|
|
210
|
+
},
|
|
211
|
+
get setInterval() {
|
|
212
|
+
return PopsCoreEnv.setInterval;
|
|
213
|
+
},
|
|
214
|
+
get clearTimeout() {
|
|
215
|
+
return PopsCoreEnv.clearTimeout;
|
|
216
|
+
},
|
|
217
|
+
get clearInterval() {
|
|
218
|
+
return PopsCoreEnv.clearInterval;
|
|
219
|
+
},
|
|
198
220
|
};
|
|
199
221
|
const OriginPrototype = {
|
|
200
222
|
Object: {
|
|
@@ -713,7 +735,7 @@ class PopsUtils {
|
|
|
713
735
|
return setTimeout$1(callback, timeout);
|
|
714
736
|
}
|
|
715
737
|
catch (error) {
|
|
716
|
-
return
|
|
738
|
+
return PopsCore.setTimeout(callback, timeout);
|
|
717
739
|
}
|
|
718
740
|
}
|
|
719
741
|
/**
|
|
@@ -728,7 +750,7 @@ class PopsUtils {
|
|
|
728
750
|
catch (error) {
|
|
729
751
|
}
|
|
730
752
|
finally {
|
|
731
|
-
|
|
753
|
+
PopsCore.clearTimeout(timeId);
|
|
732
754
|
}
|
|
733
755
|
}
|
|
734
756
|
/**
|
|
@@ -739,7 +761,7 @@ class PopsUtils {
|
|
|
739
761
|
return setInterval$1(callback, timeout);
|
|
740
762
|
}
|
|
741
763
|
catch (error) {
|
|
742
|
-
return
|
|
764
|
+
return PopsCore.setInterval(callback, timeout);
|
|
743
765
|
}
|
|
744
766
|
}
|
|
745
767
|
/**
|
|
@@ -754,7 +776,7 @@ class PopsUtils {
|
|
|
754
776
|
catch (error) {
|
|
755
777
|
}
|
|
756
778
|
finally {
|
|
757
|
-
|
|
779
|
+
PopsCore.clearInterval(timeId);
|
|
758
780
|
}
|
|
759
781
|
}
|
|
760
782
|
}
|