UNPKG

ember-app-scheduler

Version:

Ember addon to schedule work at different phases of app life cycle.

60 lines (59 loc) 1.5 kB
/** @documenter yuidoc */ import type RouterService from '@ember/routing/router-service'; import { Promise } from 'rsvp'; declare class Scheduler { isIdle: boolean; } declare const scheduler: Scheduler; export default scheduler; /** * Initializes the top level promise that initiates the post-render work. * * @public * @function beginTransition * @return {void} */ export declare function beginTransition(): void; /** * Initiates the post-render work. * * @public * @function endTransition * @return {void} */ export declare function endTransition(): void; /** * Connects the router's transition events to * app scheduler's work. * * @public * @function setupRouter * @param {RouterService|Router} router An instance of a RouterService or an Ember Router. * @return {void} */ export declare function setupRouter(router: RouterService): void; /** * Resets the state of app scheduler's top-level scheduled work promise. * * @public * @function reset * @return {void} */ export declare function reset(): void; /** * This promise, when resolved, approximates after content is painted. * * @public * @function whenRouteIdle * @return {Promise<any>} The scheduled work promise. */ export declare function whenRouteIdle(): Promise<any>; /** * Allows for tests to pause until the scheduled work * promise is completed. * * @public * @function routeSettled * @return {Promise<any>} The scheduled work promise. */ export declare function routeSettled(): Promise<any>;