You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.6 KiB
1 lines
3.6 KiB
{"version":3,"file":"AnimationFrameAction.js","sourceRoot":"","sources":["../../src/scheduler/AnimationFrameAction.ts"],"names":[],"mappings":";;;;;;AAAA,4BAA4B,eAAe,CAAC,CAAA;AAC5C,+BAA+B,wBAAwB,CAAC,CAAA;AAGxD;;;;GAIG;AACH;IAA6C,wCAAc;IAEzD,8BAAsB,SAAkC,EAClC,IAAwD;QAC5E,kBAAM,SAAS,EAAE,IAAI,CAAC,CAAC;QAFH,cAAS,GAAT,SAAS,CAAyB;QAClC,SAAI,GAAJ,IAAI,CAAoD;IAE9E,CAAC;IAES,6CAAc,GAAxB,UAAyB,SAAkC,EAAE,EAAQ,EAAE,KAAiB;QAAjB,qBAAiB,GAAjB,SAAiB;QACtF,0DAA0D;QAC1D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,gBAAK,CAAC,cAAc,YAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;QACD,qDAAqD;QACrD,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,0EAA0E;QAC1E,4EAA4E;QAC5E,0CAA0C;QAC1C,MAAM,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,+BAAc,CAAC,qBAAqB,CACvF,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CACtC,CAAC,CAAC;IACL,CAAC;IACS,6CAAc,GAAxB,UAAyB,SAAkC,EAAE,EAAQ,EAAE,KAAiB;QAAjB,qBAAiB,GAAjB,SAAiB;QACtF,sEAAsE;QACtE,sEAAsE;QACtE,2CAA2C;QAC3C,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACxE,MAAM,CAAC,gBAAK,CAAC,cAAc,YAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;QACD,4EAA4E;QAC5E,4EAA4E;QAC5E,mBAAmB;QACnB,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YACnC,+BAAc,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;YACxC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC;QAClC,CAAC;QACD,sFAAsF;QACtF,MAAM,CAAC,SAAS,CAAC;IACnB,CAAC;IACH,2BAAC;AAAD,CAAC,AAtCD,CAA6C,yBAAW,GAsCvD;AAtCY,4BAAoB,uBAsChC,CAAA","sourcesContent":["import { AsyncAction } from './AsyncAction';\nimport { AnimationFrame } from '../util/AnimationFrame';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class AnimationFrameAction<T> extends AsyncAction<T> {\n\n constructor(protected scheduler: AnimationFrameScheduler,\n protected work: (this: AnimationFrameAction<T>, state?: T) => void) {\n super(scheduler, work);\n }\n\n protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any {\n // If delay is greater than 0, request as an async action.\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n // Push the action to the end of the scheduler queue.\n scheduler.actions.push(this);\n // If an animation frame has already been requested, don't request another\n // one. If an animation frame hasn't been requested yet, request one. Return\n // the current animation frame request id.\n return scheduler.scheduled || (scheduler.scheduled = AnimationFrame.requestAnimationFrame(\n scheduler.flush.bind(scheduler, null)\n ));\n }\n protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any {\n // If delay exists and is greater than 0, or if the delay is null (the\n // action wasn't rescheduled) but was originally scheduled as an async\n // action, then recycle as an async action.\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n // If the scheduler queue is empty, cancel the requested animation frame and\n // set the scheduled flag to undefined so the next AnimationFrameAction will\n // request its own.\n if (scheduler.actions.length === 0) {\n AnimationFrame.cancelAnimationFrame(id);\n scheduler.scheduled = undefined;\n }\n // Return undefined so the action knows to request a new async id if it's rescheduled.\n return undefined;\n }\n}\n"]} |