1 | import { JSONObject, ReadonlyJSONObject } from '@lumino/coreutils';
|
2 | import { IDisposable } from '@lumino/disposable';
|
3 | import { IStream } from '@lumino/signaling';
|
4 | import { ServerConnection } from '../serverconnection';
|
5 |
|
6 |
|
7 |
|
8 | export declare class EventManager implements Event.IManager {
|
9 | |
10 |
|
11 |
|
12 | constructor(options?: EventManager.IOptions);
|
13 | /**
|
14 | * The server settings used to make API requests.
|
15 | */
|
16 | readonly serverSettings: ServerConnection.ISettings;
|
17 | /**
|
18 | * Whether the event manager is disposed.
|
19 | */
|
20 | get isDisposed(): boolean;
|
21 | /**
|
22 | * An event stream that emits and yields each new event.
|
23 | */
|
24 | get stream(): Event.Stream;
|
25 | /**
|
26 | * Dispose the event manager.
|
27 | */
|
28 | dispose(): void;
|
29 | /**
|
30 | * Post an event request to be emitted by the event bus.
|
31 | */
|
32 | emit(event: Event.Request): Promise<void>;
|
33 | /**
|
34 | * Subscribe to event bus emissions.
|
35 | */
|
36 | private _subscribe;
|
37 | private _poll;
|
38 | private _socket;
|
39 | private _stream;
|
40 | }
|
41 | /**
|
42 | * A namespace for `EventManager` statics.
|
43 | */
|
44 | export declare namespace EventManager {
|
45 | |
46 |
|
47 |
|
48 | interface IOptions {
|
49 | |
50 |
|
51 |
|
52 | serverSettings?: ServerConnection.ISettings;
|
53 | }
|
54 | }
|
55 |
|
56 |
|
57 |
|
58 | export declare namespace Event {
|
59 | |
60 |
|
61 |
|
62 | type Emission = ReadonlyJSONObject & {
|
63 | schema_id: string;
|
64 | };
|
65 | |
66 |
|
67 |
|
68 | type Request = {
|
69 | data: JSONObject;
|
70 | schema_id: string;
|
71 | version: string;
|
72 | };
|
73 | |
74 |
|
75 |
|
76 | type Stream = IStream<IManager, Emission>;
|
77 | |
78 |
|
79 |
|
80 | interface IManager extends IDisposable {
|
81 | |
82 |
|
83 |
|
84 | readonly serverSettings: ServerConnection.ISettings;
|
85 | |
86 |
|
87 |
|
88 | readonly stream: Event.Stream;
|
89 | |
90 |
|
91 |
|
92 | emit(event: Event.Request): Promise<void>;
|
93 | }
|
94 | }
|