@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.umd.js CHANGED
@@ -186,9 +186,19 @@
186
186
  window: window,
187
187
  globalThis: globalThis,
188
188
  self: self,
189
+ setTimeout: globalThis.setTimeout.bind(globalThis),
190
+ setInterval: globalThis.setInterval.bind(globalThis),
191
+ clearTimeout: globalThis.clearTimeout.bind(globalThis),
192
+ clearInterval: globalThis.clearInterval.bind(globalThis),
189
193
  };
190
194
  const PopsCoreEnv = Object.assign({}, PopsCoreDefaultEnv);
191
195
  const PopsCore = {
196
+ init(option) {
197
+ if (!option) {
198
+ option = Object.assign({}, PopsCoreDefaultEnv);
199
+ }
200
+ Object.assign(PopsCoreEnv, option);
201
+ },
192
202
  get document() {
193
203
  return PopsCoreEnv.document;
194
204
  },
@@ -201,6 +211,18 @@
201
211
  get self() {
202
212
  return PopsCoreEnv.self;
203
213
  },
214
+ get setTimeout() {
215
+ return PopsCoreEnv.setTimeout;
216
+ },
217
+ get setInterval() {
218
+ return PopsCoreEnv.setInterval;
219
+ },
220
+ get clearTimeout() {
221
+ return PopsCoreEnv.clearTimeout;
222
+ },
223
+ get clearInterval() {
224
+ return PopsCoreEnv.clearInterval;
225
+ },
204
226
  };
205
227
  const OriginPrototype = {
206
228
  Object: {
@@ -719,7 +741,7 @@
719
741
  return setTimeout$1(callback, timeout);
720
742
  }
721
743
  catch (error) {
722
- return globalThis.setTimeout(callback, timeout);
744
+ return PopsCore.setTimeout(callback, timeout);
723
745
  }
724
746
  }
725
747
  /**
@@ -734,7 +756,7 @@
734
756
  catch (error) {
735
757
  }
736
758
  finally {
737
- globalThis.clearTimeout(timeId);
759
+ PopsCore.clearTimeout(timeId);
738
760
  }
739
761
  }
740
762
  /**
@@ -745,7 +767,7 @@
745
767
  return setInterval$1(callback, timeout);
746
768
  }
747
769
  catch (error) {
748
- return globalThis.setInterval(callback, timeout);
770
+ return PopsCore.setInterval(callback, timeout);
749
771
  }
750
772
  }
751
773
  /**
@@ -760,7 +782,7 @@
760
782
  catch (error) {
761
783
  }
762
784
  finally {
763
- globalThis.clearInterval(timeId);
785
+ PopsCore.clearInterval(timeId);
764
786
  }
765
787
  }
766
788
  }