Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | import { Scheduler } from '../Scheduler';
|
---|
2 | import { Subscription } from '../Subscription';
|
---|
3 | import { SchedulerAction } from '../types';
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * A unit of work to be executed in a `scheduler`. An action is typically
|
---|
7 | * created from within a {@link SchedulerLike} and an RxJS user does not need to concern
|
---|
8 | * themselves about creating and manipulating an Action.
|
---|
9 | *
|
---|
10 | * ```ts
|
---|
11 | * class Action<T> extends Subscription {
|
---|
12 | * new (scheduler: Scheduler, work: (state?: T) => void);
|
---|
13 | * schedule(state?: T, delay: number = 0): Subscription;
|
---|
14 | * }
|
---|
15 | * ```
|
---|
16 | *
|
---|
17 | * @class Action<T>
|
---|
18 | */
|
---|
19 | export class Action<T> extends Subscription {
|
---|
20 | constructor(scheduler: Scheduler, work: (this: SchedulerAction<T>, state?: T) => void) {
|
---|
21 | super();
|
---|
22 | }
|
---|
23 | /**
|
---|
24 | * Schedules this action on its parent {@link SchedulerLike} for execution. May be passed
|
---|
25 | * some context object, `state`. May happen at some point in the future,
|
---|
26 | * according to the `delay` parameter, if specified.
|
---|
27 | * @param {T} [state] Some contextual data that the `work` function uses when
|
---|
28 | * called by the Scheduler.
|
---|
29 | * @param {number} [delay] Time to wait before executing the work, where the
|
---|
30 | * time unit is implicit and defined by the Scheduler.
|
---|
31 | * @return {void}
|
---|
32 | */
|
---|
33 | public schedule(state?: T, delay: number = 0): Subscription {
|
---|
34 | return this;
|
---|
35 | }
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.