@lowentry/utils 1.23.3 → 1.24.2
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/index.js +18 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/LeUtils.js +19 -9
package/package.json
CHANGED
package/src/LeUtils.js
CHANGED
|
@@ -158,10 +158,13 @@ export const LeUtils = {
|
|
|
158
158
|
return a.toString() === b.toString();
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
if((a.constructor !== Object) && (a.constructor !== Array) && (proto !== Object.prototype) && (typeof a.equals === 'function'))
|
|
161
|
+
if(a.constructor && (a.constructor !== Object) && (a.constructor !== Array) && (Object.getPrototypeOf(a) !== Object.prototype))
|
|
163
162
|
{
|
|
164
|
-
|
|
163
|
+
if(typeof a.equals === 'function')
|
|
164
|
+
{
|
|
165
|
+
return a.equals(b);
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
const keys = Object.keys(a);
|
|
@@ -1705,27 +1708,34 @@ export const LeUtils = {
|
|
|
1705
1708
|
|
|
1706
1709
|
let run = true;
|
|
1707
1710
|
let requestAnimationFrameId = null;
|
|
1708
|
-
let
|
|
1711
|
+
let lastTimestamp = 0;
|
|
1712
|
+
let totalTime = 0;
|
|
1709
1713
|
let frames = intervalFrames;
|
|
1710
|
-
const tick = () =>
|
|
1714
|
+
const tick = (timestamp) =>
|
|
1711
1715
|
{
|
|
1712
1716
|
if(run)
|
|
1713
1717
|
{
|
|
1718
|
+
if(lastTimestamp === 0)
|
|
1719
|
+
{
|
|
1720
|
+
lastTimestamp = timestamp;
|
|
1721
|
+
}
|
|
1722
|
+
totalTime += (timestamp - lastTimestamp);
|
|
1723
|
+
lastTimestamp = timestamp;
|
|
1724
|
+
|
|
1725
|
+
frames--;
|
|
1714
1726
|
if(frames <= 0)
|
|
1715
1727
|
{
|
|
1716
|
-
let currentTime = globalThis?.performance?.now?.() ?? 0;
|
|
1717
1728
|
try
|
|
1718
1729
|
{
|
|
1719
|
-
callback(
|
|
1730
|
+
callback(totalTime / 1000);
|
|
1720
1731
|
}
|
|
1721
1732
|
catch(e)
|
|
1722
1733
|
{
|
|
1723
1734
|
console.error(e);
|
|
1724
1735
|
}
|
|
1725
|
-
|
|
1736
|
+
totalTime = 0;
|
|
1726
1737
|
frames = intervalFrames;
|
|
1727
1738
|
}
|
|
1728
|
-
frames--;
|
|
1729
1739
|
|
|
1730
1740
|
if(run)
|
|
1731
1741
|
{
|