From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/internal/scheduler/AnimationFrameAction.ts | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/rxjs/src/internal/scheduler/AnimationFrameAction.ts (limited to 'sandbox/testAppNevena/Front/node_modules/rxjs/src/internal/scheduler/AnimationFrameAction.ts') diff --git a/sandbox/testAppNevena/Front/node_modules/rxjs/src/internal/scheduler/AnimationFrameAction.ts b/sandbox/testAppNevena/Front/node_modules/rxjs/src/internal/scheduler/AnimationFrameAction.ts new file mode 100644 index 00000000..e9ea64fa --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/rxjs/src/internal/scheduler/AnimationFrameAction.ts @@ -0,0 +1,47 @@ +import { AsyncAction } from './AsyncAction'; +import { AnimationFrameScheduler } from './AnimationFrameScheduler'; +import { SchedulerAction } from '../types'; + +/** + * We need this JSDoc comment for affecting ESDoc. + * @ignore + * @extends {Ignored} + */ +export class AnimationFrameAction extends AsyncAction { + + constructor(protected scheduler: AnimationFrameScheduler, + protected work: (this: SchedulerAction, state?: T) => void) { + super(scheduler, work); + } + + protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any { + // If delay is greater than 0, request as an async action. + if (delay !== null && delay > 0) { + return super.requestAsyncId(scheduler, id, delay); + } + // Push the action to the end of the scheduler queue. + scheduler.actions.push(this); + // If an animation frame has already been requested, don't request another + // one. If an animation frame hasn't been requested yet, request one. Return + // the current animation frame request id. + return scheduler.scheduled || (scheduler.scheduled = requestAnimationFrame( + () => scheduler.flush(null))); + } + protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any { + // If delay exists and is greater than 0, or if the delay is null (the + // action wasn't rescheduled) but was originally scheduled as an async + // action, then recycle as an async action. + if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) { + return super.recycleAsyncId(scheduler, id, delay); + } + // If the scheduler queue is empty, cancel the requested animation frame and + // set the scheduled flag to undefined so the next AnimationFrameAction will + // request its own. + if (scheduler.actions.length === 0) { + cancelAnimationFrame(id); + scheduler.scheduled = undefined; + } + // Return undefined so the action knows to request a new async id if it's rescheduled. + return undefined; + } +} -- cgit v1.2.3