@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.
@@ -183,9 +183,19 @@ var pops = (function () {
183
183
  window: window,
184
184
  globalThis: globalThis,
185
185
  self: self,
186
+ setTimeout: globalThis.setTimeout.bind(globalThis),
187
+ setInterval: globalThis.setInterval.bind(globalThis),
188
+ clearTimeout: globalThis.clearTimeout.bind(globalThis),
189
+ clearInterval: globalThis.clearInterval.bind(globalThis),
186
190
  };
187
191
  const PopsCoreEnv = Object.assign({}, PopsCoreDefaultEnv);
188
192
  const PopsCore = {
193
+ init(option) {
194
+ if (!option) {
195
+ option = Object.assign({}, PopsCoreDefaultEnv);
196
+ }
197
+ Object.assign(PopsCoreEnv, option);
198
+ },
189
199
  get document() {
190
200
  return PopsCoreEnv.document;
191
201
  },
@@ -198,6 +208,18 @@ var pops = (function () {
198
208
  get self() {
199
209
  return PopsCoreEnv.self;
200
210
  },
211
+ get setTimeout() {
212
+ return PopsCoreEnv.setTimeout;
213
+ },
214
+ get setInterval() {
215
+ return PopsCoreEnv.setInterval;
216
+ },
217
+ get clearTimeout() {
218
+ return PopsCoreEnv.clearTimeout;
219
+ },
220
+ get clearInterval() {
221
+ return PopsCoreEnv.clearInterval;
222
+ },
201
223
  };
202
224
  const OriginPrototype = {
203
225
  Object: {
@@ -716,7 +738,7 @@ var pops = (function () {
716
738
  return setTimeout$1(callback, timeout);
717
739
  }
718
740
  catch (error) {
719
- return globalThis.setTimeout(callback, timeout);
741
+ return PopsCore.setTimeout(callback, timeout);
720
742
  }
721
743
  }
722
744
  /**
@@ -731,7 +753,7 @@ var pops = (function () {
731
753
  catch (error) {
732
754
  }
733
755
  finally {
734
- globalThis.clearTimeout(timeId);
756
+ PopsCore.clearTimeout(timeId);
735
757
  }
736
758
  }
737
759
  /**
@@ -742,7 +764,7 @@ var pops = (function () {
742
764
  return setInterval$1(callback, timeout);
743
765
  }
744
766
  catch (error) {
745
- return globalThis.setInterval(callback, timeout);
767
+ return PopsCore.setInterval(callback, timeout);
746
768
  }
747
769
  }
748
770
  /**
@@ -757,7 +779,7 @@ var pops = (function () {
757
779
  catch (error) {
758
780
  }
759
781
  finally {
760
- globalThis.clearInterval(timeId);
782
+ PopsCore.clearInterval(timeId);
761
783
  }
762
784
  }
763
785
  }