UNPKG

1.9 kBTypeScriptView Raw
1import { IDisposable } from '@lumino/disposable';
2import { ISignal } from '@lumino/signaling';
3/**
4 * A class that monitors activity on a signal.
5 */
6export declare class ActivityMonitor<Sender, Args> implements IDisposable {
7 /**
8 * Construct a new activity monitor.
9 */
10 constructor(options: ActivityMonitor.IOptions<Sender, Args>);
11 /**
12 * A signal emitted when activity has ceased.
13 */
14 get activityStopped(): ISignal<this, ActivityMonitor.IArguments<Sender, Args>>;
15 /**
16 * The timeout associated with the monitor, in milliseconds.
17 */
18 get timeout(): number;
19 set timeout(value: number);
20 /**
21 * Test whether the monitor has been disposed.
22 *
23 * #### Notes
24 * This is a read-only property.
25 */
26 get isDisposed(): boolean;
27 /**
28 * Dispose of the resources used by the activity monitor.
29 */
30 dispose(): void;
31 /**
32 * A signal handler for the monitored signal.
33 */
34 private _onSignalFired;
35 private _timer;
36 private _timeout;
37 private _sender;
38 private _args;
39 private _isDisposed;
40 private _activityStopped;
41}
42/**
43 * The namespace for `ActivityMonitor` statics.
44 */
45export declare namespace ActivityMonitor {
46 /**
47 * The options used to construct a new `ActivityMonitor`.
48 */
49 interface IOptions<Sender, Args> {
50 /**
51 * The signal to monitor.
52 */
53 signal: ISignal<Sender, Args>;
54 /**
55 * The activity timeout in milliseconds.
56 *
57 * The default is 1 second.
58 */
59 timeout?: number;
60 }
61 /**
62 * The argument object for an activity timeout.
63 *
64 */
65 interface IArguments<Sender, Args> {
66 /**
67 * The most recent sender object.
68 */
69 sender: Sender;
70 /**
71 * The most recent argument object.
72 */
73 args: Args;
74 }
75}