@flighthq/app 0.5.1-next.1069.554a2ac → 0.5.1-next.1201.9b49dee
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/README.md +2 -2
- package/dist/app.d.ts +39 -41
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +81 -81
- package/dist/app.js.map +1 -1
- package/package.json +4 -4
- package/src/app.test.ts +77 -41
- package/src/appHost.test.ts +33 -46
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/app`. The `@flighthq
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/app@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/app@0.5.1-next.1201.9b49dee](https://github.com/flighthq/flight/tree/9b49dee3f22f6b2838c3d237edcc77bca65734f2/packages/app)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/9b49dee3f22f6b2838c3d237edcc77bca65734f2/LICENSE.md)
|
package/dist/app.d.ts
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
import type { App, AppActivationPolicy, AppLoginItem, AppLoginItemLike, AppPathKind, EntityConstruction,
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function clearAppRecentDocuments(host: HasAppRecentDocuments): void;
|
|
1
|
+
import type { App, AppActivationPolicy, AppLoginItem, AppLoginItemLike, AppPathKind, EntityConstruction, HostAppActivateProvider, HostAppActivationPolicyProvider, HostAppAllWindowsClosedProvider, HostAppBadgeProvider, HostAppDockProvider, HostAppFocusProvider, HostAppVisibilityQueryProvider, HostAppHideProvider, HostAppLocaleProvider, HostAppLoginItemProvider, HostAppNameProvider, HostAppNameWriteProvider, HostAppOpenFileProvider, HostAppPathProvider, HostAppQuitProvider, HostAppQuitRequestProvider, HostAppReadyProvider, HostAppRecentDocumentsProvider, HostAppRelaunchProvider, HostAppSecondInstanceProvider, HostAppShowProvider, HostAppSingleInstanceProvider, HostAppUserModelIdProvider, HostAppVersionProvider, MenuItemTemplate } from '@flighthq/types/contract';
|
|
2
|
+
export declare function addAppRecentDocument(hostAppRecentDocuments: Readonly<HostAppRecentDocumentsProvider>, path: string): void;
|
|
3
|
+
export declare function attachApp(hostAppActivate: Readonly<HostAppActivateProvider>, hostAppAllWindowsClosed: Readonly<HostAppAllWindowsClosedProvider>, hostAppOpenFile: Readonly<HostAppOpenFileProvider>, hostAppQuitRequest: Readonly<HostAppQuitRequestProvider>, hostAppReady: Readonly<HostAppReadyProvider>, hostAppSecondInstance: Readonly<HostAppSecondInstanceProvider>, app: App): void;
|
|
4
|
+
export declare function attachAppActivate(hostAppActivate: Readonly<HostAppActivateProvider>, app: App): void;
|
|
5
|
+
export declare function attachAppAllWindowsClosed(hostAppAllWindowsClosed: Readonly<HostAppAllWindowsClosedProvider>, app: App): void;
|
|
6
|
+
export declare function attachAppOpenFile(hostAppOpenFile: Readonly<HostAppOpenFileProvider>, app: App): void;
|
|
7
|
+
export declare function attachAppQuitRequest(hostAppQuitRequest: Readonly<HostAppQuitRequestProvider>, app: App): void;
|
|
8
|
+
export declare function attachAppReady(hostAppReady: Readonly<HostAppReadyProvider>, app: App): void;
|
|
9
|
+
export declare function attachAppSecondInstance(hostAppSecondInstance: Readonly<HostAppSecondInstanceProvider>, app: App): void;
|
|
10
|
+
export declare function bounceAppDock(hostAppDock: Readonly<HostAppDockProvider>): number;
|
|
11
|
+
export declare function cancelAppAttention(hostAppDock: Readonly<HostAppDockProvider>, id: number): void;
|
|
12
|
+
export declare function cancelAppDockBounce(hostAppDock: Readonly<HostAppDockProvider>, id: number): void;
|
|
13
|
+
export declare function clearAppRecentDocuments(hostAppRecentDocuments: Readonly<HostAppRecentDocumentsProvider>): void;
|
|
15
14
|
export declare function createApp(): App;
|
|
16
15
|
export declare function detachApp(app: App): void;
|
|
17
16
|
export declare function disposeApp(app: App): void;
|
|
18
|
-
export declare function focusApp(
|
|
19
|
-
export declare function getAppDirectoryPath(
|
|
20
|
-
export declare function getAppExecutablePath(
|
|
21
|
-
export declare function getAppLocale(
|
|
22
|
-
export declare function getAppLoginItem(
|
|
23
|
-
export declare function getAppName(
|
|
24
|
-
export declare function getAppPath(
|
|
25
|
-
export declare function getAppPreferredSystemLanguages(
|
|
26
|
-
export declare function getAppSystemLocale(
|
|
27
|
-
export declare function getAppVersion(
|
|
28
|
-
export declare function hasAppSingleInstanceLock(
|
|
29
|
-
export declare function hideApp(
|
|
17
|
+
export declare function focusApp(hostAppFocus: Readonly<HostAppFocusProvider>): void;
|
|
18
|
+
export declare function getAppDirectoryPath(hostAppPath: Readonly<HostAppPathProvider>, kind: AppPathKind): string;
|
|
19
|
+
export declare function getAppExecutablePath(hostAppPath: Readonly<HostAppPathProvider>): string;
|
|
20
|
+
export declare function getAppLocale(hostAppLocale: Readonly<HostAppLocaleProvider>): string;
|
|
21
|
+
export declare function getAppLoginItem(hostAppLoginItem: Readonly<HostAppLoginItemProvider>): AppLoginItem;
|
|
22
|
+
export declare function getAppName(hostAppName: Readonly<HostAppNameProvider>): string;
|
|
23
|
+
export declare function getAppPath(hostAppPath: Readonly<HostAppPathProvider>): string;
|
|
24
|
+
export declare function getAppPreferredSystemLanguages(hostAppLocale: Readonly<HostAppLocaleProvider>): readonly string[];
|
|
25
|
+
export declare function getAppSystemLocale(hostAppLocale: Readonly<HostAppLocaleProvider>): string;
|
|
26
|
+
export declare function getAppVersion(hostAppVersion: Readonly<HostAppVersionProvider>): string;
|
|
27
|
+
export declare function hasAppSingleInstanceLock(hostAppSingleInstance: Readonly<HostAppSingleInstanceProvider>): boolean;
|
|
28
|
+
export declare function hideApp(hostAppHide: Readonly<HostAppHideProvider>): void;
|
|
30
29
|
export declare function initializeApp(out: EntityConstruction<App>): void;
|
|
31
|
-
export declare function isAppHidden(
|
|
32
|
-
export declare function quitApp(
|
|
33
|
-
export declare function relaunchApp(
|
|
34
|
-
export declare function releaseAppSingleInstanceLock(
|
|
35
|
-
export declare function requestAppAttention(
|
|
36
|
-
export declare function requestAppSingleInstanceLock(
|
|
37
|
-
export declare function setAppActivationPolicy(
|
|
38
|
-
export declare function setAppBadgeCount(
|
|
39
|
-
export declare function setAppDockBadge(
|
|
40
|
-
export declare function setAppDockMenu(
|
|
41
|
-
export declare function setAppLoginItem(
|
|
42
|
-
export declare function setAppName(
|
|
43
|
-
export declare function setAppUserModelId(
|
|
44
|
-
export declare function showApp(
|
|
45
|
-
export {};
|
|
30
|
+
export declare function isAppHidden(hostAppVisibilityQuery: Readonly<HostAppVisibilityQueryProvider>): boolean;
|
|
31
|
+
export declare function quitApp(hostAppQuit: Readonly<HostAppQuitProvider>): void;
|
|
32
|
+
export declare function relaunchApp(hostAppRelaunch: Readonly<HostAppRelaunchProvider>): void;
|
|
33
|
+
export declare function releaseAppSingleInstanceLock(hostAppSingleInstance: Readonly<HostAppSingleInstanceProvider>): void;
|
|
34
|
+
export declare function requestAppAttention(hostAppDock: Readonly<HostAppDockProvider>, critical: boolean): number;
|
|
35
|
+
export declare function requestAppSingleInstanceLock(hostAppSingleInstance: Readonly<HostAppSingleInstanceProvider>): boolean;
|
|
36
|
+
export declare function setAppActivationPolicy(hostAppActivationPolicy: Readonly<HostAppActivationPolicyProvider>, policy: AppActivationPolicy): void;
|
|
37
|
+
export declare function setAppBadgeCount(hostAppBadge: Readonly<HostAppBadgeProvider>, count: number): Promise<boolean>;
|
|
38
|
+
export declare function setAppDockBadge(hostAppDock: Readonly<HostAppDockProvider>, text: string): void;
|
|
39
|
+
export declare function setAppDockMenu(hostAppDock: Readonly<HostAppDockProvider>, items: readonly MenuItemTemplate[]): void;
|
|
40
|
+
export declare function setAppLoginItem(hostAppLoginItem: Readonly<HostAppLoginItemProvider>, settings: Readonly<AppLoginItemLike>): void;
|
|
41
|
+
export declare function setAppName(hostAppNameWrite: Readonly<HostAppNameWriteProvider>, name: string): void;
|
|
42
|
+
export declare function setAppUserModelId(hostAppUserModelId: Readonly<HostAppUserModelIdProvider>, id: string): void;
|
|
43
|
+
export declare function showApp(hostAppShow: Readonly<HostAppShowProvider>): void;
|
|
46
44
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,GAAG,EACH,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,GAAG,EACH,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,EAC/B,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,8BAA8B,EAC9B,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,8BAA8B,EAC9B,uBAAuB,EACvB,6BAA6B,EAC7B,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAWlC,wBAAgB,oBAAoB,CAClC,sBAAsB,EAAE,QAAQ,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AAW,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAEnH;AAED,wBAAgB,eAAe,CAC7B,gBAAgB,EAAE,QAAQ,CAAC,wBAAwB,CAAC,EACpD,QAAQ,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GACnC,IAAI,CAEN;AAED,wBAAgB,UAAU,CAAC,gBAAgB,EAAE,QAAQ,CAAC,wBAAwB,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnG;AAED,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,0BAA0B,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE5G;AAED,wBAAgB,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAExE"}
|
package/dist/app.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
|
|
2
2
|
import { clearSignal, createSignal, emitSignal } from '@flighthq/signals/contract';
|
|
3
|
-
export function addAppRecentDocument(
|
|
4
|
-
|
|
3
|
+
export function addAppRecentDocument(hostAppRecentDocuments, path) {
|
|
4
|
+
hostAppRecentDocuments.addRecentDocument(path);
|
|
5
5
|
}
|
|
6
|
-
export function attachApp(
|
|
6
|
+
export function attachApp(hostAppActivate, hostAppAllWindowsClosed, hostAppOpenFile, hostAppQuitRequest, hostAppReady, hostAppSecondInstance, app) {
|
|
7
7
|
detachApp(app);
|
|
8
|
-
attachAppActivate(
|
|
9
|
-
attachAppAllWindowsClosed(
|
|
10
|
-
attachAppOpenFile(
|
|
11
|
-
attachAppQuitRequest(
|
|
12
|
-
attachAppReady(
|
|
13
|
-
attachAppSecondInstance(
|
|
8
|
+
attachAppActivate(hostAppActivate, app);
|
|
9
|
+
attachAppAllWindowsClosed(hostAppAllWindowsClosed, app);
|
|
10
|
+
attachAppOpenFile(hostAppOpenFile, app);
|
|
11
|
+
attachAppQuitRequest(hostAppQuitRequest, app);
|
|
12
|
+
attachAppReady(hostAppReady, app);
|
|
13
|
+
attachAppSecondInstance(hostAppSecondInstance, app);
|
|
14
14
|
}
|
|
15
|
-
export function attachAppActivate(
|
|
16
|
-
replaceAppSubscription(app, 'activate',
|
|
15
|
+
export function attachAppActivate(hostAppActivate, app) {
|
|
16
|
+
replaceAppSubscription(app, 'activate', hostAppActivate.subscribe(() => emitSignal(app.onActivate)));
|
|
17
17
|
}
|
|
18
|
-
export function attachAppAllWindowsClosed(
|
|
19
|
-
replaceAppSubscription(app, 'allWindowsClosed',
|
|
18
|
+
export function attachAppAllWindowsClosed(hostAppAllWindowsClosed, app) {
|
|
19
|
+
replaceAppSubscription(app, 'allWindowsClosed', hostAppAllWindowsClosed.subscribe(() => emitSignal(app.onAllWindowsClosed)));
|
|
20
20
|
}
|
|
21
|
-
export function attachAppOpenFile(
|
|
22
|
-
replaceAppSubscription(app, 'openFile',
|
|
21
|
+
export function attachAppOpenFile(hostAppOpenFile, app) {
|
|
22
|
+
replaceAppSubscription(app, 'openFile', hostAppOpenFile.subscribe((path) => emitSignal(app.onOpenFile, path)));
|
|
23
23
|
}
|
|
24
|
-
export function attachAppQuitRequest(
|
|
25
|
-
replaceAppSubscription(app, 'quitRequest',
|
|
24
|
+
export function attachAppQuitRequest(hostAppQuitRequest, app) {
|
|
25
|
+
replaceAppSubscription(app, 'quitRequest', hostAppQuitRequest.subscribe((cancelHost) => {
|
|
26
26
|
emitSignal(app.onQuitRequest);
|
|
27
27
|
if (app.onQuitRequest.data?.cancelled === true)
|
|
28
28
|
cancelHost();
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
|
-
export function attachAppReady(
|
|
32
|
-
replaceAppSubscription(app, 'ready',
|
|
31
|
+
export function attachAppReady(hostAppReady, app) {
|
|
32
|
+
replaceAppSubscription(app, 'ready', hostAppReady.subscribe(() => emitSignal(app.onReady)));
|
|
33
33
|
}
|
|
34
|
-
export function attachAppSecondInstance(
|
|
35
|
-
replaceAppSubscription(app, 'secondInstance',
|
|
34
|
+
export function attachAppSecondInstance(hostAppSecondInstance, app) {
|
|
35
|
+
replaceAppSubscription(app, 'secondInstance', hostAppSecondInstance.subscribe((argv) => emitSignal(app.onSecondInstance, argv)));
|
|
36
36
|
}
|
|
37
|
-
export function bounceAppDock(
|
|
38
|
-
return
|
|
37
|
+
export function bounceAppDock(hostAppDock) {
|
|
38
|
+
return hostAppDock.bounceDock();
|
|
39
39
|
}
|
|
40
|
-
export function cancelAppAttention(
|
|
41
|
-
|
|
40
|
+
export function cancelAppAttention(hostAppDock, id) {
|
|
41
|
+
hostAppDock.cancelAttention(id);
|
|
42
42
|
}
|
|
43
|
-
export function cancelAppDockBounce(
|
|
44
|
-
|
|
43
|
+
export function cancelAppDockBounce(hostAppDock, id) {
|
|
44
|
+
hostAppDock.cancelDockBounce(id);
|
|
45
45
|
}
|
|
46
|
-
export function clearAppRecentDocuments(
|
|
47
|
-
|
|
46
|
+
export function clearAppRecentDocuments(hostAppRecentDocuments) {
|
|
47
|
+
hostAppRecentDocuments.clearRecentDocuments();
|
|
48
48
|
}
|
|
49
49
|
export function createApp() {
|
|
50
50
|
const out = allocateEntity();
|
|
@@ -68,41 +68,41 @@ export function disposeApp(app) {
|
|
|
68
68
|
clearSignal(app.onReady);
|
|
69
69
|
clearSignal(app.onSecondInstance);
|
|
70
70
|
}
|
|
71
|
-
export function focusApp(
|
|
72
|
-
|
|
71
|
+
export function focusApp(hostAppFocus) {
|
|
72
|
+
hostAppFocus.focus();
|
|
73
73
|
}
|
|
74
|
-
export function getAppDirectoryPath(
|
|
75
|
-
return
|
|
74
|
+
export function getAppDirectoryPath(hostAppPath, kind) {
|
|
75
|
+
return hostAppPath.getAppDirectoryPath(kind);
|
|
76
76
|
}
|
|
77
|
-
export function getAppExecutablePath(
|
|
78
|
-
return
|
|
77
|
+
export function getAppExecutablePath(hostAppPath) {
|
|
78
|
+
return hostAppPath.getExecutablePath();
|
|
79
79
|
}
|
|
80
|
-
export function getAppLocale(
|
|
81
|
-
return
|
|
80
|
+
export function getAppLocale(hostAppLocale) {
|
|
81
|
+
return hostAppLocale.getLocale();
|
|
82
82
|
}
|
|
83
|
-
export function getAppLoginItem(
|
|
84
|
-
return
|
|
83
|
+
export function getAppLoginItem(hostAppLoginItem) {
|
|
84
|
+
return hostAppLoginItem.getLoginItem();
|
|
85
85
|
}
|
|
86
|
-
export function getAppName(
|
|
87
|
-
return
|
|
86
|
+
export function getAppName(hostAppName) {
|
|
87
|
+
return hostAppName.getName();
|
|
88
88
|
}
|
|
89
|
-
export function getAppPath(
|
|
90
|
-
return
|
|
89
|
+
export function getAppPath(hostAppPath) {
|
|
90
|
+
return hostAppPath.getAppPath();
|
|
91
91
|
}
|
|
92
|
-
export function getAppPreferredSystemLanguages(
|
|
93
|
-
return
|
|
92
|
+
export function getAppPreferredSystemLanguages(hostAppLocale) {
|
|
93
|
+
return hostAppLocale.getPreferredSystemLanguages();
|
|
94
94
|
}
|
|
95
|
-
export function getAppSystemLocale(
|
|
96
|
-
return
|
|
95
|
+
export function getAppSystemLocale(hostAppLocale) {
|
|
96
|
+
return hostAppLocale.getSystemLocale();
|
|
97
97
|
}
|
|
98
|
-
export function getAppVersion(
|
|
99
|
-
return
|
|
98
|
+
export function getAppVersion(hostAppVersion) {
|
|
99
|
+
return hostAppVersion.getVersion();
|
|
100
100
|
}
|
|
101
|
-
export function hasAppSingleInstanceLock(
|
|
102
|
-
return
|
|
101
|
+
export function hasAppSingleInstanceLock(hostAppSingleInstance) {
|
|
102
|
+
return hostAppSingleInstance.hasSingleInstanceLock();
|
|
103
103
|
}
|
|
104
|
-
export function hideApp(
|
|
105
|
-
|
|
104
|
+
export function hideApp(hostAppHide) {
|
|
105
|
+
hostAppHide.hideApp();
|
|
106
106
|
}
|
|
107
107
|
export function initializeApp(out) {
|
|
108
108
|
out.onActivate = createSignal();
|
|
@@ -112,47 +112,47 @@ export function initializeApp(out) {
|
|
|
112
112
|
out.onReady = createSignal();
|
|
113
113
|
out.onSecondInstance = createSignal();
|
|
114
114
|
}
|
|
115
|
-
export function isAppHidden(
|
|
116
|
-
return
|
|
115
|
+
export function isAppHidden(hostAppVisibilityQuery) {
|
|
116
|
+
return hostAppVisibilityQuery.isAppHidden();
|
|
117
117
|
}
|
|
118
|
-
export function quitApp(
|
|
119
|
-
|
|
118
|
+
export function quitApp(hostAppQuit) {
|
|
119
|
+
hostAppQuit.quit();
|
|
120
120
|
}
|
|
121
|
-
export function relaunchApp(
|
|
122
|
-
|
|
121
|
+
export function relaunchApp(hostAppRelaunch) {
|
|
122
|
+
hostAppRelaunch.relaunch();
|
|
123
123
|
}
|
|
124
|
-
export function releaseAppSingleInstanceLock(
|
|
125
|
-
|
|
124
|
+
export function releaseAppSingleInstanceLock(hostAppSingleInstance) {
|
|
125
|
+
hostAppSingleInstance.releaseSingleInstanceLock();
|
|
126
126
|
}
|
|
127
|
-
export function requestAppAttention(
|
|
128
|
-
return
|
|
127
|
+
export function requestAppAttention(hostAppDock, critical) {
|
|
128
|
+
return hostAppDock.requestAttention(critical);
|
|
129
129
|
}
|
|
130
|
-
export function requestAppSingleInstanceLock(
|
|
131
|
-
return
|
|
130
|
+
export function requestAppSingleInstanceLock(hostAppSingleInstance) {
|
|
131
|
+
return hostAppSingleInstance.requestSingleInstanceLock();
|
|
132
132
|
}
|
|
133
|
-
export function setAppActivationPolicy(
|
|
134
|
-
|
|
133
|
+
export function setAppActivationPolicy(hostAppActivationPolicy, policy) {
|
|
134
|
+
hostAppActivationPolicy.setActivationPolicy(policy);
|
|
135
135
|
}
|
|
136
|
-
export function setAppBadgeCount(
|
|
137
|
-
return
|
|
136
|
+
export function setAppBadgeCount(hostAppBadge, count) {
|
|
137
|
+
return hostAppBadge.setBadgeCount(count);
|
|
138
138
|
}
|
|
139
|
-
export function setAppDockBadge(
|
|
140
|
-
|
|
139
|
+
export function setAppDockBadge(hostAppDock, text) {
|
|
140
|
+
hostAppDock.setDockBadge(text);
|
|
141
141
|
}
|
|
142
|
-
export function setAppDockMenu(
|
|
143
|
-
|
|
142
|
+
export function setAppDockMenu(hostAppDock, items) {
|
|
143
|
+
hostAppDock.setDockMenu(items);
|
|
144
144
|
}
|
|
145
|
-
export function setAppLoginItem(
|
|
146
|
-
|
|
145
|
+
export function setAppLoginItem(hostAppLoginItem, settings) {
|
|
146
|
+
hostAppLoginItem.setLoginItem(settings);
|
|
147
147
|
}
|
|
148
|
-
export function setAppName(
|
|
149
|
-
|
|
148
|
+
export function setAppName(hostAppNameWrite, name) {
|
|
149
|
+
hostAppNameWrite.setName(name);
|
|
150
150
|
}
|
|
151
|
-
export function setAppUserModelId(
|
|
152
|
-
|
|
151
|
+
export function setAppUserModelId(hostAppUserModelId, id) {
|
|
152
|
+
hostAppUserModelId.setUserModelId(id);
|
|
153
153
|
}
|
|
154
|
-
export function showApp(
|
|
155
|
-
|
|
154
|
+
export function showApp(hostAppShow) {
|
|
155
|
+
hostAppShow.showApp();
|
|
156
156
|
}
|
|
157
157
|
const _subscriptions = new WeakMap();
|
|
158
158
|
function replaceAppSubscription(app, key, unsubscribe) {
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AA4CnF,MAAM,UAAU,oBAAoB,CAClC,sBAAgE,EAChE,IAAY;IAE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AAG,IAAI,OAAO,EAAyB,CAAC;AAE5D,SAAS,sBAAsB,CAAC,GAAQ,EAAE,GAA2B,EAAE,WAAuB;IAC5F,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACpD,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IACvB,aAAa,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;IACjC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/app",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.1201.9b49dee",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1201.9b49dee",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.1201.9b49dee",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.1201.9b49dee"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/app.test.ts
CHANGED
|
@@ -194,7 +194,7 @@ function createFixture() {
|
|
|
194
194
|
describe('addAppRecentDocument', () => {
|
|
195
195
|
it('delegates', () => {
|
|
196
196
|
const { host, calls } = createFixture();
|
|
197
|
-
addAppRecentDocument(host, '/tmp/a');
|
|
197
|
+
addAppRecentDocument(host.app.recentDocuments, '/tmp/a');
|
|
198
198
|
expect(calls).toContain('recent:/tmp/a');
|
|
199
199
|
});
|
|
200
200
|
});
|
|
@@ -204,8 +204,24 @@ describe('attachApp', () => {
|
|
|
204
204
|
const first = createFixture();
|
|
205
205
|
const second = createFixture();
|
|
206
206
|
const app = createApp();
|
|
207
|
-
attachApp(
|
|
208
|
-
|
|
207
|
+
attachApp(
|
|
208
|
+
first.host.app.activate,
|
|
209
|
+
first.host.app.allWindowsClosed,
|
|
210
|
+
first.host.app.openFile,
|
|
211
|
+
first.host.app.quitRequest,
|
|
212
|
+
first.host.app.ready,
|
|
213
|
+
first.host.app.secondInstance,
|
|
214
|
+
app,
|
|
215
|
+
);
|
|
216
|
+
attachApp(
|
|
217
|
+
second.host.app.activate,
|
|
218
|
+
second.host.app.allWindowsClosed,
|
|
219
|
+
second.host.app.openFile,
|
|
220
|
+
second.host.app.quitRequest,
|
|
221
|
+
second.host.app.ready,
|
|
222
|
+
second.host.app.secondInstance,
|
|
223
|
+
app,
|
|
224
|
+
);
|
|
209
225
|
expect(Object.values(first.unsubscribes).every((unsubscribe) => unsubscribe.mock.calls.length === 1)).toBe(true);
|
|
210
226
|
});
|
|
211
227
|
});
|
|
@@ -216,7 +232,7 @@ describe('attachAppActivate', () => {
|
|
|
216
232
|
const app = createApp();
|
|
217
233
|
const receive = vi.fn();
|
|
218
234
|
connectSignal(app.onActivate, receive);
|
|
219
|
-
attachAppActivate(host, app);
|
|
235
|
+
attachAppActivate(host.app.activate, app);
|
|
220
236
|
listeners.activate?.();
|
|
221
237
|
expect(receive).toHaveBeenCalledOnce();
|
|
222
238
|
});
|
|
@@ -228,7 +244,7 @@ describe('attachAppAllWindowsClosed', () => {
|
|
|
228
244
|
const app = createApp();
|
|
229
245
|
const receive = vi.fn();
|
|
230
246
|
connectSignal(app.onAllWindowsClosed, receive);
|
|
231
|
-
attachAppAllWindowsClosed(host, app);
|
|
247
|
+
attachAppAllWindowsClosed(host.app.allWindowsClosed, app);
|
|
232
248
|
listeners.allWindowsClosed?.();
|
|
233
249
|
expect(receive).toHaveBeenCalledOnce();
|
|
234
250
|
});
|
|
@@ -240,7 +256,7 @@ describe('attachAppOpenFile', () => {
|
|
|
240
256
|
const app = createApp();
|
|
241
257
|
const receive = vi.fn();
|
|
242
258
|
connectSignal(app.onOpenFile, receive);
|
|
243
|
-
attachAppOpenFile(host, app);
|
|
259
|
+
attachAppOpenFile(host.app.openFile, app);
|
|
244
260
|
listeners.openFile?.('/tmp/a.txt');
|
|
245
261
|
expect(receive).toHaveBeenCalledExactlyOnceWith('/tmp/a.txt');
|
|
246
262
|
});
|
|
@@ -252,7 +268,7 @@ describe('attachAppQuitRequest', () => {
|
|
|
252
268
|
const app = createApp();
|
|
253
269
|
const cancelHost = vi.fn();
|
|
254
270
|
connectSignal(app.onQuitRequest, () => cancelSignal(app.onQuitRequest));
|
|
255
|
-
attachAppQuitRequest(host, app);
|
|
271
|
+
attachAppQuitRequest(host.app.quitRequest, app);
|
|
256
272
|
listeners.quitRequest?.(cancelHost);
|
|
257
273
|
expect(cancelHost).toHaveBeenCalledOnce();
|
|
258
274
|
});
|
|
@@ -264,7 +280,7 @@ describe('attachAppReady', () => {
|
|
|
264
280
|
const app = createApp();
|
|
265
281
|
const receive = vi.fn();
|
|
266
282
|
connectSignal(app.onReady, receive);
|
|
267
|
-
attachAppReady(host, app);
|
|
283
|
+
attachAppReady(host.app.ready, app);
|
|
268
284
|
listeners.ready?.();
|
|
269
285
|
expect(receive).toHaveBeenCalledOnce();
|
|
270
286
|
});
|
|
@@ -276,20 +292,20 @@ describe('attachAppSecondInstance', () => {
|
|
|
276
292
|
const app = createApp();
|
|
277
293
|
const receive = vi.fn();
|
|
278
294
|
connectSignal(app.onSecondInstance, receive);
|
|
279
|
-
attachAppSecondInstance(host, app);
|
|
295
|
+
attachAppSecondInstance(host.app.secondInstance, app);
|
|
280
296
|
listeners.secondInstance?.(['--open']);
|
|
281
297
|
expect(receive).toHaveBeenCalledExactlyOnceWith(['--open']);
|
|
282
298
|
});
|
|
283
299
|
});
|
|
284
300
|
|
|
285
301
|
describe('bounceAppDock', () => {
|
|
286
|
-
it('returns the provider id', () => expect(bounceAppDock(createFixture().host)).toBe(17));
|
|
302
|
+
it('returns the provider id', () => expect(bounceAppDock(createFixture().host.app.dock)).toBe(17));
|
|
287
303
|
});
|
|
288
304
|
|
|
289
305
|
describe('cancelAppAttention', () => {
|
|
290
306
|
it('delegates', () => {
|
|
291
307
|
const { host, calls } = createFixture();
|
|
292
|
-
cancelAppAttention(host, 3);
|
|
308
|
+
cancelAppAttention(host.app.dock, 3);
|
|
293
309
|
expect(calls).toContain('cancelAttention:3');
|
|
294
310
|
});
|
|
295
311
|
});
|
|
@@ -297,14 +313,14 @@ describe('cancelAppAttention', () => {
|
|
|
297
313
|
describe('cancelAppDockBounce', () => {
|
|
298
314
|
it('delegates', () => {
|
|
299
315
|
const { host, calls } = createFixture();
|
|
300
|
-
cancelAppDockBounce(host, 4);
|
|
316
|
+
cancelAppDockBounce(host.app.dock, 4);
|
|
301
317
|
expect(calls).toContain('cancelBounce:4');
|
|
302
318
|
});
|
|
303
319
|
});
|
|
304
320
|
describe('clearAppRecentDocuments', () => {
|
|
305
321
|
it('delegates', () => {
|
|
306
322
|
const { host, calls } = createFixture();
|
|
307
|
-
clearAppRecentDocuments(host);
|
|
323
|
+
clearAppRecentDocuments(host.app.recentDocuments);
|
|
308
324
|
expect(calls).toContain('clearRecent');
|
|
309
325
|
});
|
|
310
326
|
});
|
|
@@ -326,7 +342,15 @@ describe('detachApp', () => {
|
|
|
326
342
|
it('unsubscribes every attached provider', () => {
|
|
327
343
|
const { host, unsubscribes } = createFixture();
|
|
328
344
|
const app = createApp();
|
|
329
|
-
attachApp(
|
|
345
|
+
attachApp(
|
|
346
|
+
host.app.activate,
|
|
347
|
+
host.app.allWindowsClosed,
|
|
348
|
+
host.app.openFile,
|
|
349
|
+
host.app.quitRequest,
|
|
350
|
+
host.app.ready,
|
|
351
|
+
host.app.secondInstance,
|
|
352
|
+
app,
|
|
353
|
+
);
|
|
330
354
|
detachApp(app);
|
|
331
355
|
expect(Object.values(unsubscribes).every((unsubscribe) => unsubscribe.mock.calls.length === 1)).toBe(true);
|
|
332
356
|
});
|
|
@@ -337,7 +361,15 @@ describe('disposeApp', () => {
|
|
|
337
361
|
const app = createApp();
|
|
338
362
|
const receive = vi.fn();
|
|
339
363
|
connectSignal(app.onReady, receive);
|
|
340
|
-
attachApp(
|
|
364
|
+
attachApp(
|
|
365
|
+
host.app.activate,
|
|
366
|
+
host.app.allWindowsClosed,
|
|
367
|
+
host.app.openFile,
|
|
368
|
+
host.app.quitRequest,
|
|
369
|
+
host.app.ready,
|
|
370
|
+
host.app.secondInstance,
|
|
371
|
+
app,
|
|
372
|
+
);
|
|
341
373
|
disposeApp(app);
|
|
342
374
|
listeners.ready?.();
|
|
343
375
|
expect(unsubscribes.ready).toHaveBeenCalledOnce();
|
|
@@ -347,45 +379,48 @@ describe('disposeApp', () => {
|
|
|
347
379
|
describe('focusApp', () => {
|
|
348
380
|
it('delegates', () => {
|
|
349
381
|
const { host, calls } = createFixture();
|
|
350
|
-
focusApp(host);
|
|
382
|
+
focusApp(host.app.focus);
|
|
351
383
|
expect(calls).toContain('focus');
|
|
352
384
|
});
|
|
353
385
|
});
|
|
354
386
|
describe('getAppDirectoryPath', () => {
|
|
355
387
|
it('returns the selected directory', () =>
|
|
356
|
-
expect(getAppDirectoryPath(createFixture().host, 'logs')).toBe('/app/logs'));
|
|
388
|
+
expect(getAppDirectoryPath(createFixture().host.app.path, 'logs')).toBe('/app/logs'));
|
|
357
389
|
});
|
|
358
390
|
describe('getAppExecutablePath', () => {
|
|
359
|
-
it('returns the executable path', () =>
|
|
391
|
+
it('returns the executable path', () =>
|
|
392
|
+
expect(getAppExecutablePath(createFixture().host.app.path)).toBe('/app/flight'));
|
|
360
393
|
});
|
|
361
394
|
describe('getAppLocale', () => {
|
|
362
|
-
it('returns locale', () => expect(getAppLocale(createFixture().host)).toBe('en-GB'));
|
|
395
|
+
it('returns locale', () => expect(getAppLocale(createFixture().host.app.locale)).toBe('en-GB'));
|
|
363
396
|
});
|
|
364
397
|
describe('getAppLoginItem', () => {
|
|
365
|
-
it('returns settings', () => expect(getAppLoginItem(createFixture().host).openAtLogin).toBe(true));
|
|
398
|
+
it('returns settings', () => expect(getAppLoginItem(createFixture().host.app.loginItem).openAtLogin).toBe(true));
|
|
366
399
|
});
|
|
367
400
|
describe('getAppName', () => {
|
|
368
|
-
it('returns name', () => expect(getAppName(createFixture().host)).toBe('Flight'));
|
|
401
|
+
it('returns name', () => expect(getAppName(createFixture().host.app.name)).toBe('Flight'));
|
|
369
402
|
});
|
|
370
403
|
describe('getAppPath', () => {
|
|
371
|
-
it('returns app path', () => expect(getAppPath(createFixture().host)).toBe('/app'));
|
|
404
|
+
it('returns app path', () => expect(getAppPath(createFixture().host.app.path)).toBe('/app'));
|
|
372
405
|
});
|
|
373
406
|
describe('getAppPreferredSystemLanguages', () => {
|
|
374
|
-
it('returns languages', () =>
|
|
407
|
+
it('returns languages', () =>
|
|
408
|
+
expect(getAppPreferredSystemLanguages(createFixture().host.app.locale)).toEqual(['en-GB', 'fr']));
|
|
375
409
|
});
|
|
376
410
|
describe('getAppSystemLocale', () => {
|
|
377
|
-
it('returns system locale', () => expect(getAppSystemLocale(createFixture().host)).toBe('en-US'));
|
|
411
|
+
it('returns system locale', () => expect(getAppSystemLocale(createFixture().host.app.locale)).toBe('en-US'));
|
|
378
412
|
});
|
|
379
413
|
describe('getAppVersion', () => {
|
|
380
|
-
it('returns version', () => expect(getAppVersion(createFixture().host)).toBe('1.2.3'));
|
|
414
|
+
it('returns version', () => expect(getAppVersion(createFixture().host.app.version)).toBe('1.2.3'));
|
|
381
415
|
});
|
|
382
416
|
describe('hasAppSingleInstanceLock', () => {
|
|
383
|
-
it('returns the provider fact', () =>
|
|
417
|
+
it('returns the provider fact', () =>
|
|
418
|
+
expect(hasAppSingleInstanceLock(createFixture().host.app.singleInstance)).toBe(true));
|
|
384
419
|
});
|
|
385
420
|
describe('hideApp', () => {
|
|
386
421
|
it('delegates', () => {
|
|
387
422
|
const { host, calls } = createFixture();
|
|
388
|
-
hideApp(host);
|
|
423
|
+
hideApp(host.app.hide);
|
|
389
424
|
expect(calls).toContain('hide');
|
|
390
425
|
});
|
|
391
426
|
});
|
|
@@ -395,86 +430,87 @@ describe('initializeApp', () => {
|
|
|
395
430
|
});
|
|
396
431
|
});
|
|
397
432
|
describe('isAppHidden', () => {
|
|
398
|
-
it('returns the provider fact', () => expect(isAppHidden(createFixture().host)).toBe(true));
|
|
433
|
+
it('returns the provider fact', () => expect(isAppHidden(createFixture().host.app.hiddenQuery)).toBe(true));
|
|
399
434
|
});
|
|
400
435
|
describe('quitApp', () => {
|
|
401
436
|
it('delegates', () => {
|
|
402
437
|
const { host, calls } = createFixture();
|
|
403
|
-
quitApp(host);
|
|
438
|
+
quitApp(host.app.quit);
|
|
404
439
|
expect(calls).toContain('quit');
|
|
405
440
|
});
|
|
406
441
|
});
|
|
407
442
|
describe('relaunchApp', () => {
|
|
408
443
|
it('delegates', () => {
|
|
409
444
|
const { host, calls } = createFixture();
|
|
410
|
-
relaunchApp(host);
|
|
445
|
+
relaunchApp(host.app.relaunch);
|
|
411
446
|
expect(calls).toContain('relaunch');
|
|
412
447
|
});
|
|
413
448
|
});
|
|
414
449
|
describe('releaseAppSingleInstanceLock', () => {
|
|
415
450
|
it('delegates', () => {
|
|
416
451
|
const { host, calls } = createFixture();
|
|
417
|
-
releaseAppSingleInstanceLock(host);
|
|
452
|
+
releaseAppSingleInstanceLock(host.app.singleInstance);
|
|
418
453
|
expect(calls).toContain('releaseLock');
|
|
419
454
|
});
|
|
420
455
|
});
|
|
421
456
|
describe('requestAppAttention', () => {
|
|
422
|
-
it('returns the provider id', () => expect(requestAppAttention(createFixture().host, true)).toBe(19));
|
|
457
|
+
it('returns the provider id', () => expect(requestAppAttention(createFixture().host.app.dock, true)).toBe(19));
|
|
423
458
|
});
|
|
424
459
|
describe('requestAppSingleInstanceLock', () => {
|
|
425
|
-
it('returns the provider outcome', () =>
|
|
460
|
+
it('returns the provider outcome', () =>
|
|
461
|
+
expect(requestAppSingleInstanceLock(createFixture().host.app.singleInstance)).toBe(true));
|
|
426
462
|
});
|
|
427
463
|
describe('setAppActivationPolicy', () => {
|
|
428
464
|
it('delegates', () => {
|
|
429
465
|
const { host, calls } = createFixture();
|
|
430
|
-
setAppActivationPolicy(host, 'accessory');
|
|
466
|
+
setAppActivationPolicy(host.app.activationPolicy, 'accessory');
|
|
431
467
|
expect(calls).toContain('policy:accessory');
|
|
432
468
|
});
|
|
433
469
|
});
|
|
434
470
|
describe('setAppBadgeCount', () => {
|
|
435
471
|
it('returns the awaited provider outcome', async () => {
|
|
436
|
-
await expect(setAppBadgeCount(createFixture().host, 7)).resolves.toBe(true);
|
|
472
|
+
await expect(setAppBadgeCount(createFixture().host.app.badge, 7)).resolves.toBe(true);
|
|
437
473
|
});
|
|
438
474
|
});
|
|
439
475
|
describe('setAppDockBadge', () => {
|
|
440
476
|
it('delegates', () => {
|
|
441
477
|
const { host, calls } = createFixture();
|
|
442
|
-
setAppDockBadge(host, 'x');
|
|
478
|
+
setAppDockBadge(host.app.dock, 'x');
|
|
443
479
|
expect(calls).toContain('dockBadge:x');
|
|
444
480
|
});
|
|
445
481
|
});
|
|
446
482
|
describe('setAppDockMenu', () => {
|
|
447
483
|
it('delegates', () => {
|
|
448
484
|
const { host, calls } = createFixture();
|
|
449
|
-
setAppDockMenu(host, []);
|
|
485
|
+
setAppDockMenu(host.app.dock, []);
|
|
450
486
|
expect(calls).toContain('dockMenu:0');
|
|
451
487
|
});
|
|
452
488
|
});
|
|
453
489
|
describe('setAppLoginItem', () => {
|
|
454
490
|
it('delegates', () => {
|
|
455
491
|
const { host, calls } = createFixture();
|
|
456
|
-
setAppLoginItem(host, { openAtLogin: true });
|
|
492
|
+
setAppLoginItem(host.app.loginItem, { openAtLogin: true });
|
|
457
493
|
expect(calls).toContain('loginItem');
|
|
458
494
|
});
|
|
459
495
|
});
|
|
460
496
|
describe('setAppName', () => {
|
|
461
497
|
it('delegates', () => {
|
|
462
498
|
const { host, calls } = createFixture();
|
|
463
|
-
setAppName(host, 'Renamed');
|
|
499
|
+
setAppName(host.app.nameWrite, 'Renamed');
|
|
464
500
|
expect(calls).toContain('name:Renamed');
|
|
465
501
|
});
|
|
466
502
|
});
|
|
467
503
|
describe('setAppUserModelId', () => {
|
|
468
504
|
it('delegates', () => {
|
|
469
505
|
const { host, calls } = createFixture();
|
|
470
|
-
setAppUserModelId(host, 'flight.app');
|
|
506
|
+
setAppUserModelId(host.app.userModelId, 'flight.app');
|
|
471
507
|
expect(calls).toContain('userModel:flight.app');
|
|
472
508
|
});
|
|
473
509
|
});
|
|
474
510
|
describe('showApp', () => {
|
|
475
511
|
it('delegates', () => {
|
|
476
512
|
const { host, calls } = createFixture();
|
|
477
|
-
showApp(host);
|
|
513
|
+
showApp(host.app.show);
|
|
478
514
|
expect(calls).toContain('show');
|
|
479
515
|
});
|
|
480
516
|
});
|
package/src/appHost.test.ts
CHANGED
|
@@ -7,40 +7,36 @@ import { attachApp, createApp, focusApp, getAppName, quitApp, setAppBadgeCount }
|
|
|
7
7
|
import * as appContract from './contract';
|
|
8
8
|
|
|
9
9
|
describe('app explicit Host ownership', () => {
|
|
10
|
-
it('delegates commands and queries only through the selected
|
|
10
|
+
it('delegates commands and queries only through the selected direct providers', async () => {
|
|
11
11
|
const focus = vi.fn();
|
|
12
12
|
const getName = vi.fn(() => 'Explicit App');
|
|
13
13
|
const quit = vi.fn();
|
|
14
|
-
const setBadgeCount = vi.fn(() => true);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return finishEntity(out);
|
|
36
|
-
})(),
|
|
37
|
-
},
|
|
38
|
-
};
|
|
14
|
+
const setBadgeCount = vi.fn(async () => true);
|
|
15
|
+
const hostAppBadge = (() => {
|
|
16
|
+
const out = allocateEntity<any>();
|
|
17
|
+
out.setBadgeCount = setBadgeCount;
|
|
18
|
+
return finishEntity(out);
|
|
19
|
+
})();
|
|
20
|
+
const hostAppFocus = (() => {
|
|
21
|
+
const out = allocateEntity<any>();
|
|
22
|
+
out.focus = focus;
|
|
23
|
+
return finishEntity(out);
|
|
24
|
+
})();
|
|
25
|
+
const hostAppName = (() => {
|
|
26
|
+
const out = allocateEntity<any>();
|
|
27
|
+
out.getName = getName;
|
|
28
|
+
return finishEntity(out);
|
|
29
|
+
})();
|
|
30
|
+
const hostAppQuit = (() => {
|
|
31
|
+
const out = allocateEntity<any>();
|
|
32
|
+
out.quit = quit;
|
|
33
|
+
return finishEntity(out);
|
|
34
|
+
})();
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
expect(
|
|
42
|
-
|
|
43
|
-
expect(
|
|
36
|
+
focusApp(hostAppFocus);
|
|
37
|
+
expect(getAppName(hostAppName)).toBe('Explicit App');
|
|
38
|
+
quitApp(hostAppQuit);
|
|
39
|
+
await expect(setAppBadgeCount(hostAppBadge, 3)).resolves.toBe(true);
|
|
44
40
|
|
|
45
41
|
expect(focus).toHaveBeenCalledOnce();
|
|
46
42
|
expect(getName).toHaveBeenCalledOnce();
|
|
@@ -48,7 +44,7 @@ describe('app explicit Host ownership', () => {
|
|
|
48
44
|
expect(setBadgeCount).toHaveBeenCalledExactlyOnceWith(3);
|
|
49
45
|
});
|
|
50
46
|
|
|
51
|
-
it('takes event providers
|
|
47
|
+
it('takes event providers directly and publishes an Entity', () => {
|
|
52
48
|
const listeners: { ready?: () => void } = {};
|
|
53
49
|
const subscribe = vi.fn((listener: () => void) => {
|
|
54
50
|
listeners.ready = listener;
|
|
@@ -59,25 +55,16 @@ describe('app explicit Host ownership', () => {
|
|
|
59
55
|
out.subscribe = () => vi.fn();
|
|
60
56
|
return finishEntity(out);
|
|
61
57
|
})();
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
quitRequest: inert,
|
|
68
|
-
ready: (() => {
|
|
69
|
-
const out = allocateEntity<any>();
|
|
70
|
-
out.subscribe = subscribe;
|
|
71
|
-
return finishEntity(out);
|
|
72
|
-
})(),
|
|
73
|
-
secondInstance: inert,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
58
|
+
const hostAppReady = (() => {
|
|
59
|
+
const out = allocateEntity<any>();
|
|
60
|
+
out.subscribe = subscribe;
|
|
61
|
+
return finishEntity(out);
|
|
62
|
+
})();
|
|
76
63
|
const app = createApp();
|
|
77
64
|
let readyCount = 0;
|
|
78
65
|
connectSignal(app.onReady, () => readyCount++);
|
|
79
66
|
|
|
80
|
-
|
|
67
|
+
attachApp(inert, inert, inert, inert, hostAppReady, inert, app);
|
|
81
68
|
listeners.ready?.();
|
|
82
69
|
|
|
83
70
|
expect(subscribe).toHaveBeenCalledOnce();
|