@lowentry/utils 1.13.4 → 1.13.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowentry/utils",
3
- "version": "1.13.4",
3
+ "version": "1.13.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/src/LeUtils.js CHANGED
@@ -1091,7 +1091,7 @@ export const LeUtils = {
1091
1091
  ms = FLOAT_LAX(ms);
1092
1092
 
1093
1093
  let lastTime = performance.now();
1094
- let handler = setTimeout(() =>
1094
+ let handler = window.setTimeout(() =>
1095
1095
  {
1096
1096
  const currentTime = performance.now();
1097
1097
  try
@@ -1111,7 +1111,7 @@ export const LeUtils = {
1111
1111
  {
1112
1112
  if(handler !== null)
1113
1113
  {
1114
- clearTimeout(handler);
1114
+ window.clearTimeout(handler);
1115
1115
  handler = null;
1116
1116
  }
1117
1117
  },
@@ -1159,7 +1159,7 @@ export const LeUtils = {
1159
1159
  }
1160
1160
 
1161
1161
  let lastTime = performance.now();
1162
- let handler = setInterval(() =>
1162
+ let handler = window.setInterval(() =>
1163
1163
  {
1164
1164
  const currentTime = performance.now();
1165
1165
  try
@@ -1179,7 +1179,7 @@ export const LeUtils = {
1179
1179
  {
1180
1180
  if(handler !== null)
1181
1181
  {
1182
- clearInterval(handler);
1182
+ window.clearInterval(handler);
1183
1183
  handler = null;
1184
1184
  }
1185
1185
  },
@@ -1237,7 +1237,7 @@ export const LeUtils = {
1237
1237
  return;
1238
1238
  }
1239
1239
  frames--;
1240
- requestAnimationFrameId = (typeof window === 'undefined') ? setTimeout(tick, 1000 / 60) : requestAnimationFrame(tick);
1240
+ requestAnimationFrameId = window.requestAnimationFrame(tick);
1241
1241
  }
1242
1242
  };
1243
1243
  tick();
@@ -1249,7 +1249,7 @@ export const LeUtils = {
1249
1249
  run = false;
1250
1250
  if(requestAnimationFrameId !== null)
1251
1251
  {
1252
- (typeof window === 'undefined') ? clearTimeout(requestAnimationFrameId) : cancelAnimationFrame(requestAnimationFrameId);
1252
+ window.cancelAnimationFrame(requestAnimationFrameId);
1253
1253
  requestAnimationFrameId = null;
1254
1254
  }
1255
1255
  },
@@ -1322,11 +1322,11 @@ export const LeUtils = {
1322
1322
 
1323
1323
  if(run)
1324
1324
  {
1325
- requestAnimationFrameId = (typeof window === 'undefined') ? setTimeout(tick, 1000 / 60) : requestAnimationFrame(tick);
1325
+ requestAnimationFrameId = window.requestAnimationFrame(tick);
1326
1326
  }
1327
1327
  }
1328
1328
  };
1329
- (typeof window === 'undefined') ? setTimeout(tick, 1000 / 60) : requestAnimationFrame(tick);
1329
+ window.requestAnimationFrame(tick);
1330
1330
 
1331
1331
  return {
1332
1332
  remove:
@@ -1335,7 +1335,7 @@ export const LeUtils = {
1335
1335
  run = false;
1336
1336
  if(requestAnimationFrameId !== null)
1337
1337
  {
1338
- (typeof window === 'undefined') ? clearTimeout(requestAnimationFrameId) : cancelAnimationFrame(requestAnimationFrameId);
1338
+ window.cancelAnimationFrame(requestAnimationFrameId);
1339
1339
  requestAnimationFrameId = null;
1340
1340
  }
1341
1341
  },
@@ -1356,7 +1356,7 @@ export const LeUtils = {
1356
1356
  {
1357
1357
  return new Promise(resolve => resolve(undefined));
1358
1358
  }
1359
- return new Promise(resolve => setTimeout(resolve, ms));
1359
+ return new Promise(resolve => LeUtils.setTimeout(resolve, ms));
1360
1360
  },
1361
1361
 
1362
1362
  /**