@openfin/core 30.73.23 → 30.73.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/OpenFin.d.ts +24 -25
- package/src/api/application/Instance.d.ts +1 -1
- package/src/api/base.d.ts +16 -14
- package/src/api/base.js +2 -2
- package/src/api/events/application.d.ts +65 -56
- package/src/api/events/base.d.ts +33 -15
- package/src/api/events/channel.d.ts +13 -8
- package/src/api/events/eventAggregator.js +1 -9
- package/src/api/events/externalApplication.d.ts +10 -5
- package/src/api/events/frame.d.ts +13 -7
- package/src/api/events/globalHotkey.d.ts +11 -12
- package/src/api/events/platform.d.ts +10 -16
- package/src/api/events/system.d.ts +41 -28
- package/src/api/events/typedEventEmitter.d.ts +15 -8
- package/src/api/events/view.d.ts +37 -54
- package/src/api/events/webcontents.d.ts +54 -28
- package/src/api/events/window.d.ts +147 -134
- package/src/api/external-application/Instance.d.ts +1 -1
- package/src/api/frame/Instance.d.ts +1 -1
- package/src/api/global-hotkey/index.d.ts +1 -3
- package/src/api/global-hotkey/index.js +6 -0
- package/src/api/interappbus/channel/index.d.ts +2 -2
- package/src/api/interappbus/channel/index.js +2 -0
- package/src/api/platform/Factory.js +4 -0
- package/src/api/platform/Instance.d.ts +3 -4
- package/src/api/platform/Instance.js +2 -1
- package/src/api/system/index.d.ts +471 -2
- package/src/api/system/index.js +486 -0
- package/src/api/view/Instance.d.ts +2 -2
- package/src/api/webcontents/main.d.ts +2 -2
- package/src/api/webcontents/main.js +10 -0
- package/src/api/window/Instance.d.ts +1 -3
- package/src/api/window/Instance.js +2 -0
- package/src/transport/transport.d.ts +3 -3
package/package.json
CHANGED
package/src/OpenFin.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Application } from './api/application';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { ApplicationEvent } from './api/events/application';
|
|
3
|
+
import { ExternalApplicationEvent } from './api/events/externalApplication';
|
|
4
|
+
import { FrameEvent } from './api/events/frame';
|
|
5
|
+
import { GlobalHotkeyEvent } from './api/events/globalHotkey';
|
|
6
|
+
import { PlatformEvent } from './api/events/platform';
|
|
7
|
+
import { AppVersionEvent, SystemEvent } from './api/events/system';
|
|
8
|
+
import { TypedEventEmitter } from './api/events/typedEventEmitter';
|
|
9
|
+
import { ViewEvent } from './api/events/view';
|
|
10
|
+
import { WindowEvent, WindowOptionsChangedEvent } from './api/events/window';
|
|
10
11
|
import type { ExternalApplication } from './api/external-application';
|
|
11
12
|
import { FinApi } from './api/fin';
|
|
12
13
|
import type { _Frame } from './api/frame';
|
|
@@ -770,7 +771,7 @@ export declare type PlatformProvider = {
|
|
|
770
771
|
* The new context will be contained as `payload.diff.customContext.newVal`.
|
|
771
772
|
* @return { Promise<HostContextChangedPayload> } The event that it raised.
|
|
772
773
|
*/
|
|
773
|
-
onWindowContextUpdated(payload: WindowOptionsChangedEvent
|
|
774
|
+
onWindowContextUpdated(payload: WindowOptionsChangedEvent): Promise<HostContextChangedPayload | undefined>;
|
|
774
775
|
/**
|
|
775
776
|
* Closes a Window.
|
|
776
777
|
* By default it will fire any before unload handler set by a View in the Window.
|
|
@@ -979,21 +980,7 @@ export declare type AppVersionRuntimeInfo = {
|
|
|
979
980
|
healthCheck: boolean | null;
|
|
980
981
|
error: string | null;
|
|
981
982
|
};
|
|
982
|
-
export declare type
|
|
983
|
-
type: 'app-version-progress';
|
|
984
|
-
} & AppVersionProgress;
|
|
985
|
-
export declare type AppVersionErrorEvent = {
|
|
986
|
-
type: 'app-version-error';
|
|
987
|
-
} & AppVersionError;
|
|
988
|
-
export declare type AppVersionCompleteEvent = {
|
|
989
|
-
type: 'app-version-complete';
|
|
990
|
-
} & AppVersionProgress;
|
|
991
|
-
export declare type AppVersionRuntimeStatusEvent = {
|
|
992
|
-
type: 'runtime-status';
|
|
993
|
-
} & AppVersionRuntimeInfo;
|
|
994
|
-
export declare type AppVersionEvents = AppVersionProgressEvent | AppVersionRuntimeStatusEvent | AppVersionCompleteEvent | AppVersionErrorEvent;
|
|
995
|
-
export declare type AppVersionEventNames = AppVersionEvents['type'];
|
|
996
|
-
export declare type LaunchEmitter = import('./api/events/typedEventEmitter').TypedEventEmitter<AppVersionEvents>;
|
|
983
|
+
export declare type LaunchEmitter = TypedEventEmitter<AppVersionEvent>;
|
|
997
984
|
export declare type RvmLaunchOptions = {
|
|
998
985
|
noUi?: boolean;
|
|
999
986
|
userAppConfigArgs?: object;
|
|
@@ -1433,7 +1420,19 @@ export interface PopupResult<T = any> {
|
|
|
1433
1420
|
data?: T;
|
|
1434
1421
|
lastDispatchResult?: PopupResult;
|
|
1435
1422
|
}
|
|
1436
|
-
export type
|
|
1423
|
+
export declare type AppVersionProgressEvent = {
|
|
1424
|
+
type: 'app-version-progress';
|
|
1425
|
+
} & AppVersionProgress;
|
|
1426
|
+
export declare type AppVersionErrorEvent = {
|
|
1427
|
+
type: 'app-version-error';
|
|
1428
|
+
} & AppVersionError;
|
|
1429
|
+
export declare type AppVersionCompleteEvent = {
|
|
1430
|
+
type: 'app-version-complete';
|
|
1431
|
+
} & AppVersionProgress;
|
|
1432
|
+
export declare type AppVersionRuntimeStatusEvent = {
|
|
1433
|
+
type: 'runtime-status';
|
|
1434
|
+
} & AppVersionRuntimeInfo;
|
|
1435
|
+
export type { SystemEvent, ApplicationEvent, WindowEvent, ViewEvent, GlobalHotkeyEvent, FrameEvent, PlatformEvent, ExternalApplicationEvent };
|
|
1437
1436
|
export declare type ContextMenuOptions = {
|
|
1438
1437
|
template?: Array<PrebuiltContextMenuItem>;
|
|
1439
1438
|
enabled?: boolean;
|
|
@@ -7,7 +7,7 @@ import Transport from '../../transport/transport';
|
|
|
7
7
|
* @class
|
|
8
8
|
* @hideconstructor
|
|
9
9
|
*/
|
|
10
|
-
export declare class Application extends EmitterBase<OpenFin.
|
|
10
|
+
export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
|
|
11
11
|
identity: OpenFin.ApplicationIdentity;
|
|
12
12
|
_manifestUrl?: string;
|
|
13
13
|
private window;
|
package/src/api/base.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import type * as OpenFin from '../OpenFin';
|
|
4
3
|
import Transport from '../transport/transport';
|
|
4
|
+
import type * as OpenFin from '../OpenFin';
|
|
5
5
|
import Fin from './fin';
|
|
6
|
-
import {
|
|
6
|
+
import { BaseEvent, EventHandler } from './events/base';
|
|
7
7
|
declare type ApplicationIdentity = OpenFin.ApplicationIdentity;
|
|
8
8
|
declare type Identity = OpenFin.Identity;
|
|
9
9
|
export declare class Base {
|
|
@@ -15,27 +15,29 @@ export declare class Base {
|
|
|
15
15
|
protected isOpenFinEnvironment: () => boolean;
|
|
16
16
|
protected isBrowserEnvironment: () => boolean;
|
|
17
17
|
}
|
|
18
|
-
export declare class EmitterBase<
|
|
18
|
+
export declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType extends EmitterEvent['type'] = EmitterEvent['type']> extends Base {
|
|
19
19
|
#private;
|
|
20
20
|
private topic;
|
|
21
21
|
protected identity: ApplicationIdentity;
|
|
22
22
|
constructor(wire: Transport, topic: string, ...additionalAccessors: string[]);
|
|
23
23
|
eventNames: () => (string | symbol)[];
|
|
24
|
-
emit: <
|
|
24
|
+
emit: <EventType extends EmitterEventType>(eventType: EventType, payload: Extract<EmitterEvent, {
|
|
25
|
+
type: EventType;
|
|
26
|
+
}>, ...args: any[]) => boolean;
|
|
25
27
|
private hasEmitter;
|
|
26
28
|
private getOrCreateEmitter;
|
|
27
29
|
listeners: (type: string | symbol) => Function[];
|
|
28
30
|
listenerCount: (type: string | symbol) => number;
|
|
29
|
-
protected registerEventListener: (eventType:
|
|
30
|
-
protected deregisterEventListener: (eventType:
|
|
31
|
-
on<
|
|
32
|
-
addListener: <
|
|
33
|
-
once<
|
|
34
|
-
prependListener<
|
|
35
|
-
prependOnceListener<
|
|
36
|
-
removeListener<
|
|
37
|
-
protected deregisterAllListeners(eventType:
|
|
38
|
-
removeAllListeners(eventType?:
|
|
31
|
+
protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
|
|
32
|
+
protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
|
|
33
|
+
on<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
34
|
+
addListener: <EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions) => Promise<this>;
|
|
35
|
+
once<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
36
|
+
prependListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
37
|
+
prependOnceListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
38
|
+
removeListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
39
|
+
protected deregisterAllListeners(eventType: EmitterEventType): Promise<EventEmitter | void>;
|
|
40
|
+
removeAllListeners(eventType?: EmitterEventType): Promise<this>;
|
|
39
41
|
private deleteEmitterIfNothingRegistered;
|
|
40
42
|
}
|
|
41
43
|
export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
|
package/src/api/base.js
CHANGED
|
@@ -42,8 +42,8 @@ class EmitterBase extends Base {
|
|
|
42
42
|
this.topic = topic;
|
|
43
43
|
_EmitterBase_emitterAccessor.set(this, void 0);
|
|
44
44
|
this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
|
|
45
|
-
this.emit = (
|
|
46
|
-
return this.hasEmitter() ? this.getOrCreateEmitter().emit(
|
|
45
|
+
this.emit = (eventType, payload, ...args) => {
|
|
46
|
+
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
47
47
|
};
|
|
48
48
|
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
|
|
49
49
|
this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
|
|
@@ -1,70 +1,79 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export
|
|
2
|
+
import { IdentityEvent, NamedEvent, PropagatedEvent } from './base';
|
|
3
|
+
import { PropagatedWindowEvent } from './window';
|
|
4
|
+
import { PropagatedViewEvent } from './view';
|
|
5
|
+
export declare type CrashedEvent = NamedEvent & {
|
|
6
|
+
type: 'crashed';
|
|
6
7
|
reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory' | 'integrity-failure';
|
|
7
8
|
exitCode: number;
|
|
8
9
|
details: {
|
|
9
10
|
reason: string;
|
|
10
11
|
exitCode: number;
|
|
11
12
|
};
|
|
12
|
-
}
|
|
13
|
-
export
|
|
14
|
-
|
|
13
|
+
};
|
|
14
|
+
export declare type RunRequestedEvent = IdentityEvent & {
|
|
15
|
+
type: 'run-requested';
|
|
16
|
+
userAppConfigArgs: Record<string, any>;
|
|
15
17
|
manifest: OpenFin.ManifestInfo;
|
|
16
|
-
}
|
|
17
|
-
export
|
|
18
|
+
};
|
|
19
|
+
export declare type TrayIconClickedEvent = IdentityEvent & {
|
|
20
|
+
type: 'tray-icon-clicked';
|
|
18
21
|
button: 0 | 1 | 2;
|
|
19
22
|
bounds: OpenFin.Rectangle;
|
|
20
23
|
x: number;
|
|
21
24
|
y: number;
|
|
22
25
|
monitorInfo: any;
|
|
23
|
-
}
|
|
24
|
-
export interface ApplicationEventMapping<Topic = string, Type = string> extends BaseEventMap {
|
|
25
|
-
'closed': ApplicationEvent<Topic, Type>;
|
|
26
|
-
'connected': ApplicationEvent<Topic, Type>;
|
|
27
|
-
'crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
|
|
28
|
-
'initialized': ApplicationEvent<Topic, Type>;
|
|
29
|
-
'manifest-changed': ApplicationEvent<Topic, Type>;
|
|
30
|
-
'not-responding': ApplicationEvent<Topic, Type>;
|
|
31
|
-
'responding': ApplicationEvent<Topic, Type>;
|
|
32
|
-
'run-requested': RunRequestedEvent<Topic, Type>;
|
|
33
|
-
'started': ApplicationEvent<Topic, Type>;
|
|
34
|
-
'tray-icon-clicked': TrayIconClicked<Topic, Type>;
|
|
35
|
-
'window-alert-requested': WindowAlertRequestedEvent<Topic, Type>;
|
|
36
|
-
'window-auth-requested': WindowAuthRequestedEvent<Topic, Type>;
|
|
37
|
-
'window-created': WindowEvent<Topic, Type>;
|
|
38
|
-
'window-end-load': WindowEndLoadEvent<Topic, Type>;
|
|
39
|
-
'window-not-responding': WindowEvent<Topic, Type>;
|
|
40
|
-
'window-performance-report': WindowPerformanceReport<Topic, Type>;
|
|
41
|
-
'window-responding': WindowEvent<Topic, Type>;
|
|
42
|
-
'window-show-requested': WindowEvent<Topic, Type>;
|
|
43
|
-
'window-start-load': WindowEvent<Topic, Type>;
|
|
44
|
-
}
|
|
45
|
-
export interface PropagatedApplicationEventMapping<Topic = string, Type = string> {
|
|
46
|
-
'application-closed': ApplicationEvent<Topic, Type>;
|
|
47
|
-
'application-connected': ApplicationEvent<Topic, Type>;
|
|
48
|
-
'application-crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
|
|
49
|
-
'application-initialized': ApplicationEvent<Topic, Type>;
|
|
50
|
-
'application-manifest-changed': ApplicationEvent<Topic, Type>;
|
|
51
|
-
'application-not-responding': ApplicationEvent<Topic, Type>;
|
|
52
|
-
'application-responding': ApplicationEvent<Topic, Type>;
|
|
53
|
-
'application-started': ApplicationEvent<Topic, Type>;
|
|
54
|
-
'application-tray-icon-clicked': TrayIconClicked<Topic, Type>;
|
|
55
|
-
'window-created': WindowEvent<Topic, Type>;
|
|
56
|
-
'window-did-change-theme-color': WindowEvent<Topic, Type>;
|
|
57
|
-
'window-end-load': WindowEndLoadEvent<Topic, Type>;
|
|
58
|
-
'window-not-responding': WindowEvent<Topic, Type>;
|
|
59
|
-
'window-page-favicon-updated': WindowEvent<Topic, Type>;
|
|
60
|
-
'window-page-title-updated': WindowEvent<Topic, Type>;
|
|
61
|
-
'window-performance-report': WindowPerformanceReport<Topic, Type>;
|
|
62
|
-
'window-responding': WindowEvent<Topic, Type>;
|
|
63
|
-
'window-start-load': WindowEvent<Topic, Type>;
|
|
64
|
-
}
|
|
65
|
-
export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & PropagatedViewEvents<'application'> & {
|
|
66
|
-
[Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type];
|
|
67
|
-
};
|
|
68
|
-
export declare type PropagatedApplicationEvents<Topic> = {
|
|
69
|
-
[Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping<Topic, Type>[Type];
|
|
70
26
|
};
|
|
27
|
+
export declare type WindowAlertRequestedEvent = NamedEvent & {
|
|
28
|
+
type: 'window-alert-requested';
|
|
29
|
+
};
|
|
30
|
+
export declare type WindowCreatedEvent = NamedEvent & {
|
|
31
|
+
type: 'window-created';
|
|
32
|
+
};
|
|
33
|
+
export declare type WindowEndLoadEvent = NamedEvent & {
|
|
34
|
+
type: 'window-end-load';
|
|
35
|
+
};
|
|
36
|
+
export declare type WindowNotRespondingEvent = NamedEvent & {
|
|
37
|
+
type: 'window-not-responding';
|
|
38
|
+
};
|
|
39
|
+
export declare type WindowRespondingEvent = NamedEvent & {
|
|
40
|
+
type: 'window-responding';
|
|
41
|
+
};
|
|
42
|
+
export declare type WindowStartLoadEvent = NamedEvent & {
|
|
43
|
+
type: 'window-start-load';
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A Window event that is natively published at the Application level (not Window).
|
|
47
|
+
*/
|
|
48
|
+
export declare type ApplicationWindowEvent = WindowAlertRequestedEvent | WindowCreatedEvent | WindowEndLoadEvent | WindowNotRespondingEvent | WindowRespondingEvent | WindowStartLoadEvent;
|
|
49
|
+
export declare type ClosedEvent = IdentityEvent & {
|
|
50
|
+
type: 'closed';
|
|
51
|
+
};
|
|
52
|
+
export declare type ApplicationConnectedEvent = IdentityEvent & {
|
|
53
|
+
type: 'connected';
|
|
54
|
+
};
|
|
55
|
+
export declare type InitializedEvent = IdentityEvent & {
|
|
56
|
+
type: 'initialized';
|
|
57
|
+
};
|
|
58
|
+
export declare type ManifestChangedEvent = IdentityEvent & {
|
|
59
|
+
type: 'manifest-changed';
|
|
60
|
+
};
|
|
61
|
+
export declare type NotRespondingEvent = IdentityEvent & {
|
|
62
|
+
type: 'not-responding';
|
|
63
|
+
};
|
|
64
|
+
export declare type RespondingEvent = IdentityEvent & {
|
|
65
|
+
type: 'responding';
|
|
66
|
+
};
|
|
67
|
+
export declare type StartedEvent = IdentityEvent & {
|
|
68
|
+
type: 'started';
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* An Application event that does propagate to (republish on) parent topics.
|
|
72
|
+
*/
|
|
73
|
+
export declare type WillPropagateApplicationEvent = ClosedEvent | ApplicationConnectedEvent | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent | StartedEvent | TrayIconClickedEvent;
|
|
74
|
+
export declare type ApplicationEvent = {
|
|
75
|
+
topic: 'application';
|
|
76
|
+
} & (PropagatedViewEvent | PropagatedWindowEvent | ApplicationWindowEvent | WillPropagateApplicationEvent);
|
|
77
|
+
export declare type ApplicationEventType = ApplicationEvent['type'];
|
|
78
|
+
export declare type PropagatedApplicationEvent = PropagatedEvent<'application', WillPropagateApplicationEvent> | ApplicationWindowEvent;
|
|
79
|
+
export declare type PropagatedApplicationEventType = PropagatedApplicationEvent['type'];
|
package/src/api/events/base.d.ts
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type * as OpenFin from '../../OpenFin';
|
|
2
|
+
/**
|
|
3
|
+
* Modifies an event key to reflect propagation by prefixing with the topic.
|
|
4
|
+
*/
|
|
5
|
+
export declare type PropagatedEventType<Topic extends string, Type extends string> = `${Topic}-${Type}`;
|
|
6
|
+
/**
|
|
7
|
+
* Modifies an event shape to reflect propagation to a parent topic. The 'type' field
|
|
8
|
+
* is prefixed with the original topic, and a new property is added with the original topic's identity.
|
|
9
|
+
*/
|
|
10
|
+
export declare type PropagatedEvent<Topic extends string, Event extends {
|
|
11
|
+
type: string;
|
|
12
|
+
}> = Event extends infer E extends {
|
|
13
|
+
type: string;
|
|
14
|
+
} ? Omit<E, 'type'> & {
|
|
15
|
+
type: PropagatedEventType<Topic, E['type']>;
|
|
16
|
+
} & {
|
|
17
|
+
[topic in `${Topic}Identity`]: OpenFin.Identity;
|
|
18
|
+
} : never;
|
|
19
|
+
/**
|
|
20
|
+
* Handler for an event on an EventEmitter; selects the correct type for the event
|
|
21
|
+
* payload from the provided union based on the provided string literal type.
|
|
22
|
+
*/
|
|
23
|
+
export declare type EventHandler<EmitterEvent extends BaseEvent, EventType extends string> = (payload: Extract<EmitterEvent, {
|
|
24
|
+
type: EventType;
|
|
25
|
+
}>, ...args: any[]) => void;
|
|
26
|
+
export declare type BaseEvent = {
|
|
27
|
+
topic: string;
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
export declare type IdentityEvent = BaseEvent & {
|
|
8
31
|
uuid: string;
|
|
9
|
-
}
|
|
10
|
-
export
|
|
32
|
+
};
|
|
33
|
+
export declare type NamedEvent = IdentityEvent & {
|
|
11
34
|
name: string;
|
|
12
|
-
}
|
|
13
|
-
export interface BaseEventMap {
|
|
14
|
-
[name: string]: any;
|
|
15
|
-
newListener: string;
|
|
16
|
-
listenerRemoved: string;
|
|
17
|
-
}
|
|
35
|
+
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { NamedEvent } from './base';
|
|
2
|
+
export declare type BaseChannelEvent = NamedEvent & {
|
|
3
3
|
channelName: string;
|
|
4
4
|
channelId: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
};
|
|
6
|
+
export declare type ChannelConnectedEvent = BaseChannelEvent & {
|
|
7
|
+
type: 'connected';
|
|
8
|
+
};
|
|
9
|
+
export declare type ChannelDisconnectedEvent = BaseChannelEvent & {
|
|
10
|
+
type: 'disconnected';
|
|
11
|
+
};
|
|
12
|
+
export declare type ChannelEvent = {
|
|
13
|
+
topic: 'channel';
|
|
14
|
+
} & (ChannelConnectedEvent | ChannelDisconnectedEvent);
|
|
15
|
+
export declare type ChannelEventType = ChannelEvent['type'];
|
|
@@ -6,11 +6,7 @@ function isEventMessage(message) {
|
|
|
6
6
|
}
|
|
7
7
|
function mapKeyFromEvent(event) {
|
|
8
8
|
const { topic } = event;
|
|
9
|
-
if (topic === 'frame') {
|
|
10
|
-
const { uuid, name } = event;
|
|
11
|
-
return [topic, uuid, name];
|
|
12
|
-
}
|
|
13
|
-
if (topic === 'window') {
|
|
9
|
+
if (topic === 'frame' || topic === 'window' || topic === 'view') {
|
|
14
10
|
const { uuid, name } = event;
|
|
15
11
|
return [topic, uuid, name];
|
|
16
12
|
}
|
|
@@ -18,10 +14,6 @@ function mapKeyFromEvent(event) {
|
|
|
18
14
|
const { uuid } = event;
|
|
19
15
|
return [topic, uuid];
|
|
20
16
|
}
|
|
21
|
-
if (topic === 'view') {
|
|
22
|
-
const { uuid, name } = event;
|
|
23
|
-
return [topic, uuid, name];
|
|
24
|
-
}
|
|
25
17
|
return [topic];
|
|
26
18
|
}
|
|
27
19
|
class EventAggregator extends emitterMap_1.EmitterMap {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { BaseEvent } from './base';
|
|
2
|
+
export declare type ExternalApplicationConnectedEvent = BaseEvent & {
|
|
3
|
+
type: 'connected';
|
|
4
|
+
};
|
|
5
|
+
export declare type ExternalApplicationDisconnectedEvent = BaseEvent & {
|
|
6
|
+
type: 'disconnected';
|
|
7
|
+
};
|
|
8
|
+
export declare type ExternalApplicationEvent = {
|
|
9
|
+
topic: 'externalapplication';
|
|
10
|
+
} & (ExternalApplicationConnectedEvent | ExternalApplicationDisconnectedEvent);
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { NamedEvent } from './base';
|
|
2
|
+
export declare type BaseFrameEvent = NamedEvent & {
|
|
3
3
|
entityType: 'iframe';
|
|
4
4
|
frameName: string;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
};
|
|
6
|
+
export declare type FrameConnectedEvent = BaseFrameEvent & {
|
|
7
|
+
type: 'connected';
|
|
8
|
+
};
|
|
9
|
+
export declare type FrameDisconnectedEvent = BaseFrameEvent & {
|
|
10
|
+
type: 'disconnected';
|
|
11
|
+
};
|
|
12
|
+
export declare type FrameEvent = {
|
|
13
|
+
topic: 'frame';
|
|
14
|
+
} & (FrameConnectedEvent | FrameDisconnectedEvent);
|
|
15
|
+
export declare type FrameEventType = FrameEvent['type'];
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
1
|
+
import { BaseEvent } from './base';
|
|
2
|
+
export declare type RegisteredEvent = BaseEvent & {
|
|
3
|
+
type: 'registered';
|
|
4
|
+
};
|
|
5
|
+
export declare type UnregisteredEvent = BaseEvent & {
|
|
6
|
+
type: 'unregistered';
|
|
7
|
+
};
|
|
8
|
+
export declare type GlobalHotkeyEvent = {
|
|
9
|
+
topic: 'global-hotkey';
|
|
10
|
+
hotkey: 'string';
|
|
11
|
+
} & (RegisteredEvent | UnregisteredEvent);
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'platform-api-ready': ApplicationEvent<Topic, Type>;
|
|
7
|
-
'platform-snapshot-applied': ApplicationEvent<Topic, Type>;
|
|
8
|
-
}
|
|
9
|
-
export interface PropagatedPlatformEventMapping<Topic = string, Type = string> extends PropagatedApplicationEventMapping {
|
|
10
|
-
'platform-api-ready': ApplicationEvent<Topic, Type>;
|
|
11
|
-
'platform-snapshot-applied': ApplicationEvent<Topic, Type>;
|
|
12
|
-
}
|
|
13
|
-
export declare type PlatformEvents = PropagatedWindowEvents<'application'> & PropagatedViewEvents<'application'> & {
|
|
14
|
-
[Type in keyof PlatformEventMapping]: PlatformEventMapping<'application', Type>[Type];
|
|
1
|
+
import { BaseEvent } from './base';
|
|
2
|
+
import { PropagatedViewEvent } from './view';
|
|
3
|
+
import { PropagatedWindowEvent } from './window';
|
|
4
|
+
export declare type PlatformApiReadyEvent = BaseEvent & {
|
|
5
|
+
type: 'platform-api-ready';
|
|
15
6
|
};
|
|
16
|
-
export declare type
|
|
17
|
-
|
|
7
|
+
export declare type PlatformSnapshotAppliedEvent = BaseEvent & {
|
|
8
|
+
type: 'platform-snapshot-applied';
|
|
18
9
|
};
|
|
10
|
+
export declare type PlatformEvent = {
|
|
11
|
+
topic: 'platform';
|
|
12
|
+
} & (PropagatedWindowEvent | PropagatedViewEvent | PlatformApiReadyEvent | PlatformSnapshotAppliedEvent);
|
|
@@ -1,38 +1,51 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { PropagatedApplicationEvent } from './application';
|
|
3
|
+
import { BaseEvent } from './base';
|
|
4
|
+
import { PropagatedViewEvent } from './view';
|
|
5
|
+
import { PropagatedWindowEvent } from './window';
|
|
6
|
+
import { AppVersionCompleteEvent, AppVersionErrorEvent, AppVersionProgressEvent, AppVersionRuntimeStatusEvent } from '../../OpenFin';
|
|
7
|
+
declare type NotRequested<EventType> = EventType extends `${infer U}-requested` ? never : EventType;
|
|
8
|
+
declare type ExcludeRequested<Event extends {
|
|
9
|
+
type: string;
|
|
10
|
+
}> = Event & {
|
|
11
|
+
type: NotRequested<Event['type']>;
|
|
12
|
+
};
|
|
13
|
+
export declare type IdleEvent = {
|
|
14
|
+
type: 'idle-state-changed';
|
|
7
15
|
elapsedTime: number;
|
|
8
16
|
isIdle: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare type MonitorEvent
|
|
11
|
-
|
|
17
|
+
};
|
|
18
|
+
export declare type MonitorEvent = OpenFin.MonitorInfo & {
|
|
19
|
+
type: 'monitor-info-changed';
|
|
20
|
+
};
|
|
21
|
+
export declare type SessionChangedEvent = {
|
|
22
|
+
type: 'session-changed';
|
|
12
23
|
reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown';
|
|
13
|
-
}
|
|
14
|
-
export declare type SystemEventMapping<Topic = string, Type = string> = BaseEventMap & {
|
|
15
|
-
'application-created': ApplicationEvent<Topic, Type>;
|
|
16
|
-
'desktop-icon-clicked': ApplicationEvent<Topic, Type>;
|
|
17
|
-
'idle-state-changed': IdleEvent<Topic, Type>;
|
|
18
|
-
'monitor-info-changed': MonitorEvent<Topic, Type>;
|
|
19
|
-
'session-changed': SessionChangedEvent<Topic, Type>;
|
|
20
24
|
};
|
|
21
|
-
export declare type
|
|
25
|
+
export declare type AppVersionEvent = AppVersionProgressEvent | AppVersionRuntimeStatusEvent | AppVersionCompleteEvent | AppVersionErrorEvent;
|
|
26
|
+
export declare type AppVersionEventType = AppVersionEvent['type'];
|
|
27
|
+
export declare type IdEventType = WithId<AppVersionEventType>;
|
|
28
|
+
export declare type WithId<T extends AppVersionEventType> = `${T}.${string}`;
|
|
22
29
|
export declare type WithoutId<T extends string> = T extends WithId<infer U> ? U : never;
|
|
23
|
-
declare type
|
|
24
|
-
declare type IdEventNames = WithId<AppVersionEventNames>;
|
|
25
|
-
export declare type AppVersionTypeFromIdEvent<T extends IdEventNames> = Extract<OpenFin.AppVersionEvents, {
|
|
30
|
+
export declare type AppVersionTypeFromIdEvent<T extends IdEventType> = Extract<AppVersionEvent, {
|
|
26
31
|
type: WithoutId<T>;
|
|
27
32
|
}>;
|
|
28
|
-
export declare type
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
export declare type EventWithId<Event extends AppVersionEvent> = Event extends infer E extends {
|
|
34
|
+
type: AppVersionEventType;
|
|
35
|
+
} ? Omit<E, 'type'> & {
|
|
36
|
+
type: WithId<E['type']>;
|
|
37
|
+
topic: 'system';
|
|
38
|
+
appVersionId: string;
|
|
39
|
+
} : never;
|
|
40
|
+
export declare type AppVersionEventWithId = EventWithId<AppVersionEvent>;
|
|
41
|
+
export declare type ApplicationCreatedEvent = BaseEvent & {
|
|
42
|
+
type: 'application-created';
|
|
43
|
+
};
|
|
44
|
+
export declare type DesktopIconClickedEvent = BaseEvent & {
|
|
45
|
+
type: 'desktop-icon-clicked';
|
|
34
46
|
};
|
|
35
|
-
export declare type
|
|
36
|
-
|
|
37
|
-
} &
|
|
47
|
+
export declare type SystemEvent = {
|
|
48
|
+
topic: 'system';
|
|
49
|
+
} & (ExcludeRequested<PropagatedWindowEvent> | ExcludeRequested<PropagatedViewEvent> | PropagatedApplicationEvent | ApplicationCreatedEvent | DesktopIconClickedEvent | IdleEvent | MonitorEvent | SessionChangedEvent | AppVersionEventWithId);
|
|
50
|
+
export declare type SystemEventType = SystemEvent['type'];
|
|
38
51
|
export {};
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
export declare type Listener<T extends {
|
|
2
2
|
type: string;
|
|
3
3
|
}> = (payload: T) => void;
|
|
4
|
-
export interface TypedEventEmitter<
|
|
4
|
+
export interface TypedEventEmitter<Event extends {
|
|
5
5
|
type: string;
|
|
6
|
-
}> {
|
|
7
|
-
on<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
}, EmitterEventType = Event['type']> {
|
|
7
|
+
on<EventType extends EmitterEventType>(event: EventType, listener: Listener<Extract<Event, {
|
|
8
|
+
type: EventType;
|
|
9
|
+
}>>): this;
|
|
10
|
+
addListener<EventType extends EmitterEventType>(event: EventType, listener: Listener<Extract<Event, {
|
|
11
|
+
type: EventType;
|
|
12
|
+
}>>): this;
|
|
13
|
+
removeListener<EventType extends EmitterEventType>(event: EventType, listener: Listener<Extract<Event, {
|
|
14
|
+
type: EventType;
|
|
15
|
+
}>>): this;
|
|
16
|
+
removeAllListeners<EventType extends EmitterEventType>(event?: EmitterEventType): this;
|
|
17
|
+
emit<EventType extends EmitterEventType>(event: EventType, payload: Extract<Event, {
|
|
18
|
+
type: EventType;
|
|
19
|
+
}>): boolean;
|
|
13
20
|
}
|