Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

framesync

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

framesync - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

9

dist/framesync.cjs.js

@@ -18,2 +18,3 @@ 'use strict';

let isProcessing = false;
let flushNextFrame = false;
const toKeepAlive = new WeakSet();

@@ -40,2 +41,6 @@ const step = {

process: (frameData) => {
if (isProcessing) {
flushNextFrame = true;
return;
}
isProcessing = true;

@@ -56,2 +61,6 @@ [toRun, toRunNextFrame] = [toRunNextFrame, toRun];

isProcessing = false;
if (flushNextFrame) {
flushNextFrame = false;
step.process(frameData);
}
},

@@ -58,0 +67,0 @@ };

@@ -20,2 +20,3 @@ (function (global, factory) {

let isProcessing = false;
let flushNextFrame = false;
const toKeepAlive = new WeakSet();

@@ -42,2 +43,6 @@ const step = {

process: (frameData) => {
if (isProcessing) {
flushNextFrame = true;
return;
}
isProcessing = true;

@@ -58,2 +63,6 @@ [toRun, toRunNextFrame] = [toRunNextFrame, toRun];

isProcessing = false;
if (flushNextFrame) {
flushNextFrame = false;
step.process(frameData);
}
},

@@ -60,0 +69,0 @@ };

2

dist/framesync.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).framesync={})}(this,(function(e){"use strict";const t=1/60*1e3,n="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),o="undefined"!=typeof window?e=>window.requestAnimationFrame(e):e=>setTimeout((()=>e(n())),t);let c=!0,d=!1,s=!1;const r={delta:0,timestamp:0},a=["read","update","preRender","render","postRender"],f=a.reduce(((e,t)=>(e[t]=function(e){let t=[],n=[],o=0,c=!1;const d=new WeakSet,s={schedule:(e,s=!1,r=!1)=>{const a=r&&c,f=a?t:n;return s&&d.add(e),-1===f.indexOf(e)&&(f.push(e),a&&c&&(o=t.length)),e},cancel:e=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1),d.delete(e)},process:r=>{if(c=!0,[t,n]=[n,t],n.length=0,o=t.length,o)for(let n=0;n<o;n++){const o=t[n];o(r),d.has(o)&&(s.schedule(o),e())}c=!1}};return s}((()=>d=!0)),e)),{}),i=a.reduce(((e,t)=>{const n=f[t];return e[t]=(e,t=!1,o=!1)=>(d||h(),n.schedule(e,t,o)),e}),{}),u=a.reduce(((e,t)=>(e[t]=f[t].cancel,e)),{}),l=a.reduce(((e,t)=>(e[t]=()=>f[t].process(r),e)),{}),p=e=>f[e].process(r),m=e=>{d=!1,r.delta=c?t:Math.max(Math.min(e-r.timestamp,40),1),r.timestamp=e,s=!0,a.forEach(p),s=!1,d&&(c=!1,o(m))},h=()=>{d=!0,c=!0,s||o(m)};e.cancelSync=u,e.default=i,e.flushSync=l,e.getFrameData=()=>r,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).framesync={})}(this,(function(e){"use strict";const t=1/60*1e3,n="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),o="undefined"!=typeof window?e=>window.requestAnimationFrame(e):e=>setTimeout((()=>e(n())),t);let s=!0,c=!1,d=!1;const r={delta:0,timestamp:0},a=["read","update","preRender","render","postRender"],f=a.reduce(((e,t)=>(e[t]=function(e){let t=[],n=[],o=0,s=!1,c=!1;const d=new WeakSet,r={schedule:(e,c=!1,r=!1)=>{const a=r&&s,f=a?t:n;return c&&d.add(e),-1===f.indexOf(e)&&(f.push(e),a&&s&&(o=t.length)),e},cancel:e=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1),d.delete(e)},process:a=>{if(s)c=!0;else{if(s=!0,[t,n]=[n,t],n.length=0,o=t.length,o)for(let n=0;n<o;n++){const o=t[n];o(a),d.has(o)&&(r.schedule(o),e())}s=!1,c&&(c=!1,r.process(a))}}};return r}((()=>c=!0)),e)),{}),i=a.reduce(((e,t)=>{const n=f[t];return e[t]=(e,t=!1,o=!1)=>(c||h(),n.schedule(e,t,o)),e}),{}),u=a.reduce(((e,t)=>(e[t]=f[t].cancel,e)),{}),l=a.reduce(((e,t)=>(e[t]=()=>f[t].process(r),e)),{}),p=e=>f[e].process(r),m=e=>{c=!1,r.delta=s?t:Math.max(Math.min(e-r.timestamp,40),1),r.timestamp=e,d=!0,a.forEach(p),d=!1,c&&(s=!1,o(m))},h=()=>{c=!0,s=!0,d||o(m)};e.cancelSync=u,e.default=i,e.flushSync=l,e.getFrameData=()=>r,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -1,2 +0,3 @@

import sync, { cancelSync } from "../";
import { __awaiter } from "tslib";
import sync, { cancelSync, flushSync } from "../";
import { onNextFrame } from "../on-next-frame";

@@ -108,3 +109,19 @@ describe("onNextFrame", () => {

});
it("correctly keeps alive after a flush", () => __awaiter(void 0, void 0, void 0, function* () {
const promise = new Promise((resolve) => {
let v = 0;
sync.update(() => {
if (v === 2)
flushSync.update();
}, true);
sync.update(() => {
v++;
if (v > 6)
resolve(true);
}, true);
});
flushSync.update();
return expect(promise).resolves.toBe(true);
}));
});
//# sourceMappingURL=test.js.map

@@ -6,2 +6,3 @@ export function createRenderStep(runNextFrame) {

let isProcessing = false;
let flushNextFrame = false;
const toKeepAlive = new WeakSet();

@@ -28,2 +29,6 @@ const step = {

process: (frameData) => {
if (isProcessing) {
flushNextFrame = true;
return;
}
isProcessing = true;

@@ -44,2 +49,6 @@ [toRun, toRunNextFrame] = [toRunNextFrame, toRun];

isProcessing = false;
if (flushNextFrame) {
flushNextFrame = false;
step.process(frameData);
}
},

@@ -46,0 +55,0 @@ };

{
"name": "framesync",
"license": "MIT",
"version": "6.0.0",
"version": "6.0.1",
"description": "A frame-synced render loop for JavaScript",

@@ -6,0 +6,0 @@ "author": "Matt Perry",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc