Front end of the Slack clone application.

Scheduler.js.map 3.0KB

1
  1. {"version":3,"file":"Scheduler.js","sourceRoot":"","sources":["../src/Scheduler.ts"],"names":[],"mappings":";AAOA;;;;;;;;;;;;;;;GAeG;AACH;IAIE,mBAAoB,eAA8B,EACtC,GAAiC;QAAjC,mBAAiC,GAAjC,MAAoB,SAAS,CAAC,GAAG;QADzB,oBAAe,GAAf,eAAe,CAAe;QAEhD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAYD;;;;;;;;;;;;;;;;OAgBG;IACI,4BAAQ,GAAf,UAAmB,IAA0C,EAAE,KAAiB,EAAE,KAAS;QAA5B,qBAAiB,GAAjB,SAAiB;QAC9E,MAAM,CAAC,IAAI,IAAI,CAAC,eAAe,CAAI,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;IApCa,aAAG,GAAiB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,cAAM,OAAA,CAAC,IAAI,IAAI,EAAE,EAAX,CAAW,CAAC;IAqC5E,gBAAC;AAAD,CAAC,AAvCD,IAuCC;AAvCY,iBAAS,YAuCrB,CAAA","sourcesContent":["import { Action } from './scheduler/Action';\nimport { Subscription } from './Subscription';\n\nexport interface IScheduler {\n now(): number;\n schedule<T>(work: (this: Action<T>, state?: T) => void, delay?: number, state?: T): Subscription;\n}\n/**\n * An execution context and a data structure to order tasks and schedule their\n * execution. Provides a notion of (potentially virtual) time, through the\n * `now()` getter method.\n *\n * Each unit of work in a Scheduler is called an {@link Action}.\n *\n * ```ts\n * class Scheduler {\n * now(): number;\n * schedule(work, delay?, state?): Subscription;\n * }\n * ```\n *\n * @class Scheduler\n */\nexport class Scheduler implements IScheduler {\n\n public static now: () => number = Date.now ? Date.now : () => +new Date();\n\n constructor(private SchedulerAction: typeof Action,\n now: () => number = Scheduler.now) {\n this.now = now;\n }\n\n /**\n * A getter method that returns a number representing the current time\n * (at the time this function was called) according to the scheduler's own\n * internal clock.\n * @return {number} A number that represents the current time. May or may not\n * have a relation to wall-clock time. May or may not refer to a time unit\n * (e.g. milliseconds).\n */\n public now: () => number;\n\n /**\n * Schedules a function, `work`, for execution. May happen at some point in\n * the future, according to the `delay` parameter, if specified. May be passed\n * some context object, `state`, which will be passed to the `work` function.\n *\n * The given arguments will be processed an stored as an Action object in a\n * queue of actions.\n *\n * @param {function(state: ?T): ?Subscription} work A function representing a\n * task, or some unit of work to be executed by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler itself.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @return {Subscription} A subscription in order to be able to unsubscribe\n * the scheduled work.\n */\n public schedule<T>(work: (this: Action<T>, state?: T) => void, delay: number = 0, state?: T): Subscription {\n return new this.SchedulerAction<T>(this, work).schedule(state, delay);\n }\n}\n"]}