canvu-react 0.4.75 → 0.4.76
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.cjs +28 -402
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -402
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +40 -414
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +40 -414
- package/dist/react.js.map +1 -1
- package/dist/realtimeNative.cjs +5 -3
- package/dist/realtimeNative.cjs.map +1 -1
- package/dist/realtimeNative.js +5 -3
- package/dist/realtimeNative.js.map +1 -1
- package/package.json +1 -1
- package/dist/pdf.mjs +0 -28
- package/dist/pdf.worker.mjs +0 -31
package/dist/realtimeNative.js
CHANGED
|
@@ -449,7 +449,7 @@ function requestRuntimeAnimationFrame(callback) {
|
|
|
449
449
|
}
|
|
450
450
|
function cancelRuntimeAnimationFrame(handle) {
|
|
451
451
|
const runtime = globalThis;
|
|
452
|
-
if (typeof runtime.cancelAnimationFrame === "function") {
|
|
452
|
+
if (typeof runtime.cancelAnimationFrame === "function" && typeof handle === "number") {
|
|
453
453
|
runtime.cancelAnimationFrame(handle);
|
|
454
454
|
return;
|
|
455
455
|
}
|
|
@@ -524,7 +524,7 @@ function useRealtimePeerFollow(options) {
|
|
|
524
524
|
const [, setViewportSizeVersion] = useState(0);
|
|
525
525
|
useEffect(() => {
|
|
526
526
|
if (!followedPeerId) return;
|
|
527
|
-
let animationFrameId =
|
|
527
|
+
let animationFrameId = null;
|
|
528
528
|
let lastViewportSizeKey = getViewportSizeKey(viewportRef.current ?? null);
|
|
529
529
|
const checkViewportSize = () => {
|
|
530
530
|
const nextViewportSizeKey = getViewportSizeKey(viewportRef.current ?? null);
|
|
@@ -536,7 +536,9 @@ function useRealtimePeerFollow(options) {
|
|
|
536
536
|
};
|
|
537
537
|
animationFrameId = requestRuntimeAnimationFrame(checkViewportSize);
|
|
538
538
|
return () => {
|
|
539
|
-
|
|
539
|
+
if (animationFrameId !== null) {
|
|
540
|
+
cancelRuntimeAnimationFrame(animationFrameId);
|
|
541
|
+
}
|
|
540
542
|
};
|
|
541
543
|
}, [followedPeerId, viewportRef]);
|
|
542
544
|
useEffect(() => {
|