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