@etsoo/appscript 1.2.38 → 1.2.42

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.
Files changed (38) hide show
  1. package/lib/cjs/bridges/BridgeUtils.d.ts +15 -0
  2. package/lib/cjs/bridges/BridgeUtils.js +41 -0
  3. package/lib/cjs/bridges/IBridgeHost.d.ts +19 -0
  4. package/lib/cjs/bridges/{IAppData.js → IBridgeHost.js} +0 -0
  5. package/lib/cjs/index.d.ts +2 -3
  6. package/lib/cjs/index.js +2 -3
  7. package/lib/cjs/result/ActionResult.d.ts +2 -2
  8. package/lib/cjs/result/IActionResult.d.ts +9 -18
  9. package/lib/cjs/result/InitCallResult.d.ts +2 -2
  10. package/lib/mjs/bridges/BridgeUtils.d.ts +15 -0
  11. package/lib/mjs/bridges/BridgeUtils.js +38 -0
  12. package/lib/mjs/bridges/IBridgeHost.d.ts +19 -0
  13. package/lib/mjs/bridges/{IAppData.js → IBridgeHost.js} +0 -0
  14. package/lib/mjs/index.d.ts +2 -3
  15. package/lib/mjs/index.js +2 -3
  16. package/lib/mjs/result/ActionResult.d.ts +2 -2
  17. package/lib/mjs/result/IActionResult.d.ts +9 -18
  18. package/lib/mjs/result/InitCallResult.d.ts +2 -2
  19. package/package.json +5 -5
  20. package/src/bridges/BridgeUtils.ts +48 -0
  21. package/src/bridges/IBridgeHost.ts +21 -0
  22. package/src/index.ts +2 -3
  23. package/src/result/ActionResult.ts +2 -2
  24. package/src/result/IActionResult.ts +11 -19
  25. package/src/result/InitCallResult.ts +2 -2
  26. package/lib/cjs/bridges/ElectronBridge.d.ts +0 -7
  27. package/lib/cjs/bridges/ElectronBridge.js +0 -9
  28. package/lib/cjs/bridges/IAppData.d.ts +0 -17
  29. package/lib/cjs/bridges/IBridge.d.ts +0 -26
  30. package/lib/cjs/bridges/IBridge.js +0 -2
  31. package/lib/mjs/bridges/ElectronBridge.d.ts +0 -7
  32. package/lib/mjs/bridges/ElectronBridge.js +0 -6
  33. package/lib/mjs/bridges/IAppData.d.ts +0 -17
  34. package/lib/mjs/bridges/IBridge.d.ts +0 -26
  35. package/lib/mjs/bridges/IBridge.js +0 -1
  36. package/src/bridges/ElectronBridge.ts +0 -8
  37. package/src/bridges/IAppData.ts +0 -19
  38. package/src/bridges/IBridge.ts +0 -28
@@ -0,0 +1,15 @@
1
+ import { IBridgeHost } from './IBridgeHost';
2
+ /**
3
+ * Bridge utils
4
+ */
5
+ export declare namespace BridgeUtils {
6
+ /**
7
+ * Is electron client
8
+ * @returns Result
9
+ */
10
+ function isElectronClient(): boolean;
11
+ /**
12
+ * Bridge host
13
+ */
14
+ const host: IBridgeHost | undefined;
15
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BridgeUtils = void 0;
4
+ /**
5
+ * Bridge utils
6
+ */
7
+ var BridgeUtils;
8
+ (function (BridgeUtils) {
9
+ /**
10
+ * Is electron client
11
+ * @returns Result
12
+ */
13
+ function isElectronClient() {
14
+ // Renderer process
15
+ if (typeof window !== 'undefined' &&
16
+ typeof window.process === 'object' &&
17
+ window.process.type === 'renderer') {
18
+ return true;
19
+ }
20
+ // Main process
21
+ if (typeof process !== 'undefined' &&
22
+ typeof process.versions === 'object' &&
23
+ !!process.versions.electron) {
24
+ return true;
25
+ }
26
+ // Detect the user agent when the `nodeIntegration` option is set to true
27
+ if (typeof navigator === 'object' &&
28
+ typeof navigator.userAgent === 'string' &&
29
+ navigator.userAgent.indexOf('Electron') >= 0) {
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+ BridgeUtils.isElectronClient = isElectronClient;
35
+ /**
36
+ * Bridge host
37
+ */
38
+ BridgeUtils.host = isElectronClient()
39
+ ? globalThis.electron
40
+ : undefined;
41
+ })(BridgeUtils = exports.BridgeUtils || (exports.BridgeUtils = {}));
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Bridge host
3
+ */
4
+ export interface IBridgeHost {
5
+ /**
6
+ * Change culture
7
+ * @param locale Locale
8
+ */
9
+ changeCulture(locale: string): void;
10
+ /**
11
+ * Exit the application
12
+ */
13
+ exit(): void;
14
+ /**
15
+ * Load application
16
+ * @param name App name
17
+ */
18
+ loadApp(name: string): void;
19
+ }
File without changes
@@ -5,9 +5,8 @@ export * from './app/AppSettings';
5
5
  export * from './app/CoreApp';
6
6
  export * from './app/ExternalSettings';
7
7
  export * from './app/UserRole';
8
- export * from './bridges/ElectronBridge';
9
- export * from './bridges/IAppData';
10
- export * from './bridges/IBridge';
8
+ export * from './bridges/BridgeUtils';
9
+ export * from './bridges/IBridgeHost';
11
10
  export * from './business/BusinessTax';
12
11
  export * from './business/BusinessUtils';
13
12
  export * from './business/EntityStatus';
package/lib/cjs/index.js CHANGED
@@ -21,9 +21,8 @@ __exportStar(require("./app/CoreApp"), exports);
21
21
  __exportStar(require("./app/ExternalSettings"), exports);
22
22
  __exportStar(require("./app/UserRole"), exports);
23
23
  // bridges
24
- __exportStar(require("./bridges/ElectronBridge"), exports);
25
- __exportStar(require("./bridges/IAppData"), exports);
26
- __exportStar(require("./bridges/IBridge"), exports);
24
+ __exportStar(require("./bridges/BridgeUtils"), exports);
25
+ __exportStar(require("./bridges/IBridgeHost"), exports);
27
26
  // business
28
27
  __exportStar(require("./business/BusinessTax"), exports);
29
28
  __exportStar(require("./business/BusinessUtils"), exports);
@@ -1,4 +1,4 @@
1
- import { IActionResult, IResultData } from './IActionResult';
1
+ import { IActionResult } from './IActionResult';
2
2
  /**
3
3
  * Action result
4
4
  */
@@ -7,5 +7,5 @@ export declare class ActionResult {
7
7
  * Create a result from error
8
8
  * @returns Action result interface
9
9
  */
10
- static create<D extends IResultData = IResultData>(error: Error): IActionResult<D>;
10
+ static create<D extends {} = {}>(error: Error): IActionResult<D>;
11
11
  }
@@ -1,19 +1,4 @@
1
- /**
2
- * Result data
3
- * Indexable type
4
- */
5
- export interface IResultData {
6
- readonly [key: string]: any;
7
- }
8
- /**
9
- * Result data with id, follow this style to extend for specific model
10
- */
11
- export interface IdResultData extends IResultData {
12
- /**
13
- * Id
14
- */
15
- id: number | string;
16
- }
1
+ import { DataTypes } from '@etsoo/shared';
17
2
  /**
18
3
  * Result errors
19
4
  * Indexable type
@@ -24,7 +9,7 @@ export interface IResultErrors {
24
9
  /**
25
10
  * Operation result interface
26
11
  */
27
- export interface IActionResult<D extends IResultData = IResultData> {
12
+ export interface IActionResult<D extends {} = {}> {
28
13
  /**
29
14
  * Status code
30
15
  */
@@ -65,4 +50,10 @@ export interface IActionResult<D extends IResultData = IResultData> {
65
50
  /**
66
51
  * Action result with id data
67
52
  */
68
- export declare type ActionResultId = IActionResult<IdResultData>;
53
+ export declare type IdActionResult<T extends DataTypes.IdType = number> = IActionResult<{
54
+ id: T;
55
+ }>;
56
+ /**
57
+ * Action result with dynamic data
58
+ */
59
+ export declare type DynamicActionResult = IActionResult<Record<string, any>>;
@@ -1,8 +1,8 @@
1
- import { IActionResult, IResultData } from './IActionResult';
1
+ import { IActionResult } from './IActionResult';
2
2
  /**
3
3
  * Init call result data
4
4
  */
5
- export interface InitCallResultData extends IResultData {
5
+ export interface InitCallResultData {
6
6
  /**
7
7
  * Device id
8
8
  */
@@ -0,0 +1,15 @@
1
+ import { IBridgeHost } from './IBridgeHost';
2
+ /**
3
+ * Bridge utils
4
+ */
5
+ export declare namespace BridgeUtils {
6
+ /**
7
+ * Is electron client
8
+ * @returns Result
9
+ */
10
+ function isElectronClient(): boolean;
11
+ /**
12
+ * Bridge host
13
+ */
14
+ const host: IBridgeHost | undefined;
15
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Bridge utils
3
+ */
4
+ export var BridgeUtils;
5
+ (function (BridgeUtils) {
6
+ /**
7
+ * Is electron client
8
+ * @returns Result
9
+ */
10
+ function isElectronClient() {
11
+ // Renderer process
12
+ if (typeof window !== 'undefined' &&
13
+ typeof window.process === 'object' &&
14
+ window.process.type === 'renderer') {
15
+ return true;
16
+ }
17
+ // Main process
18
+ if (typeof process !== 'undefined' &&
19
+ typeof process.versions === 'object' &&
20
+ !!process.versions.electron) {
21
+ return true;
22
+ }
23
+ // Detect the user agent when the `nodeIntegration` option is set to true
24
+ if (typeof navigator === 'object' &&
25
+ typeof navigator.userAgent === 'string' &&
26
+ navigator.userAgent.indexOf('Electron') >= 0) {
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ BridgeUtils.isElectronClient = isElectronClient;
32
+ /**
33
+ * Bridge host
34
+ */
35
+ BridgeUtils.host = isElectronClient()
36
+ ? globalThis.electron
37
+ : undefined;
38
+ })(BridgeUtils || (BridgeUtils = {}));
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Bridge host
3
+ */
4
+ export interface IBridgeHost {
5
+ /**
6
+ * Change culture
7
+ * @param locale Locale
8
+ */
9
+ changeCulture(locale: string): void;
10
+ /**
11
+ * Exit the application
12
+ */
13
+ exit(): void;
14
+ /**
15
+ * Load application
16
+ * @param name App name
17
+ */
18
+ loadApp(name: string): void;
19
+ }
File without changes
@@ -5,9 +5,8 @@ export * from './app/AppSettings';
5
5
  export * from './app/CoreApp';
6
6
  export * from './app/ExternalSettings';
7
7
  export * from './app/UserRole';
8
- export * from './bridges/ElectronBridge';
9
- export * from './bridges/IAppData';
10
- export * from './bridges/IBridge';
8
+ export * from './bridges/BridgeUtils';
9
+ export * from './bridges/IBridgeHost';
11
10
  export * from './business/BusinessTax';
12
11
  export * from './business/BusinessUtils';
13
12
  export * from './business/EntityStatus';
package/lib/mjs/index.js CHANGED
@@ -8,9 +8,8 @@ export * from './app/CoreApp';
8
8
  export * from './app/ExternalSettings';
9
9
  export * from './app/UserRole';
10
10
  // bridges
11
- export * from './bridges/ElectronBridge';
12
- export * from './bridges/IAppData';
13
- export * from './bridges/IBridge';
11
+ export * from './bridges/BridgeUtils';
12
+ export * from './bridges/IBridgeHost';
14
13
  // business
15
14
  export * from './business/BusinessTax';
16
15
  export * from './business/BusinessUtils';
@@ -1,4 +1,4 @@
1
- import { IActionResult, IResultData } from './IActionResult';
1
+ import { IActionResult } from './IActionResult';
2
2
  /**
3
3
  * Action result
4
4
  */
@@ -7,5 +7,5 @@ export declare class ActionResult {
7
7
  * Create a result from error
8
8
  * @returns Action result interface
9
9
  */
10
- static create<D extends IResultData = IResultData>(error: Error): IActionResult<D>;
10
+ static create<D extends {} = {}>(error: Error): IActionResult<D>;
11
11
  }
@@ -1,19 +1,4 @@
1
- /**
2
- * Result data
3
- * Indexable type
4
- */
5
- export interface IResultData {
6
- readonly [key: string]: any;
7
- }
8
- /**
9
- * Result data with id, follow this style to extend for specific model
10
- */
11
- export interface IdResultData extends IResultData {
12
- /**
13
- * Id
14
- */
15
- id: number | string;
16
- }
1
+ import { DataTypes } from '@etsoo/shared';
17
2
  /**
18
3
  * Result errors
19
4
  * Indexable type
@@ -24,7 +9,7 @@ export interface IResultErrors {
24
9
  /**
25
10
  * Operation result interface
26
11
  */
27
- export interface IActionResult<D extends IResultData = IResultData> {
12
+ export interface IActionResult<D extends {} = {}> {
28
13
  /**
29
14
  * Status code
30
15
  */
@@ -65,4 +50,10 @@ export interface IActionResult<D extends IResultData = IResultData> {
65
50
  /**
66
51
  * Action result with id data
67
52
  */
68
- export declare type ActionResultId = IActionResult<IdResultData>;
53
+ export declare type IdActionResult<T extends DataTypes.IdType = number> = IActionResult<{
54
+ id: T;
55
+ }>;
56
+ /**
57
+ * Action result with dynamic data
58
+ */
59
+ export declare type DynamicActionResult = IActionResult<Record<string, any>>;
@@ -1,8 +1,8 @@
1
- import { IActionResult, IResultData } from './IActionResult';
1
+ import { IActionResult } from './IActionResult';
2
2
  /**
3
3
  * Init call result data
4
4
  */
5
- export interface InitCallResultData extends IResultData {
5
+ export interface InitCallResultData {
6
6
  /**
7
7
  * Device id
8
8
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.38",
3
+ "version": "1.2.42",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -54,23 +54,23 @@
54
54
  "dependencies": {
55
55
  "@etsoo/notificationbase": "^1.1.1",
56
56
  "@etsoo/restclient": "^1.0.64",
57
- "@etsoo/shared": "^1.1.10",
57
+ "@etsoo/shared": "^1.1.11",
58
58
  "@types/crypto-js": "^4.1.0",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@babel/cli": "^7.17.0",
63
- "@babel/core": "^7.17.0",
63
+ "@babel/core": "^7.17.2",
64
64
  "@babel/plugin-transform-runtime": "^7.17.0",
65
65
  "@babel/preset-env": "^7.16.11",
66
- "@babel/runtime-corejs3": "^7.17.0",
66
+ "@babel/runtime-corejs3": "^7.17.2",
67
67
  "@types/jest": "^27.4.0",
68
68
  "@typescript-eslint/eslint-plugin": "^5.11.0",
69
69
  "@typescript-eslint/parser": "^5.11.0",
70
70
  "eslint": "^8.8.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.25.4",
73
- "jest": "^27.5.0",
73
+ "jest": "^27.5.1",
74
74
  "ts-jest": "^27.1.3",
75
75
  "typescript": "^4.5.5"
76
76
  }
@@ -0,0 +1,48 @@
1
+ import { IBridgeHost } from './IBridgeHost';
2
+
3
+ /**
4
+ * Bridge utils
5
+ */
6
+ export namespace BridgeUtils {
7
+ /**
8
+ * Is electron client
9
+ * @returns Result
10
+ */
11
+ export function isElectronClient() {
12
+ // Renderer process
13
+ if (
14
+ typeof window !== 'undefined' &&
15
+ typeof window.process === 'object' &&
16
+ (window.process as any).type === 'renderer'
17
+ ) {
18
+ return true;
19
+ }
20
+
21
+ // Main process
22
+ if (
23
+ typeof process !== 'undefined' &&
24
+ typeof process.versions === 'object' &&
25
+ !!process.versions.electron
26
+ ) {
27
+ return true;
28
+ }
29
+
30
+ // Detect the user agent when the `nodeIntegration` option is set to true
31
+ if (
32
+ typeof navigator === 'object' &&
33
+ typeof navigator.userAgent === 'string' &&
34
+ navigator.userAgent.indexOf('Electron') >= 0
35
+ ) {
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ }
41
+
42
+ /**
43
+ * Bridge host
44
+ */
45
+ export const host = isElectronClient()
46
+ ? ((globalThis as any).electron as IBridgeHost)
47
+ : undefined;
48
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Bridge host
3
+ */
4
+ export interface IBridgeHost {
5
+ /**
6
+ * Change culture
7
+ * @param locale Locale
8
+ */
9
+ changeCulture(locale: string): void;
10
+
11
+ /**
12
+ * Exit the application
13
+ */
14
+ exit(): void;
15
+
16
+ /**
17
+ * Load application
18
+ * @param name App name
19
+ */
20
+ loadApp(name: string): void;
21
+ }
package/src/index.ts CHANGED
@@ -10,9 +10,8 @@ export * from './app/ExternalSettings';
10
10
  export * from './app/UserRole';
11
11
 
12
12
  // bridges
13
- export * from './bridges/ElectronBridge';
14
- export * from './bridges/IAppData';
15
- export * from './bridges/IBridge';
13
+ export * from './bridges/BridgeUtils';
14
+ export * from './bridges/IBridgeHost';
16
15
 
17
16
  // business
18
17
  export * from './business/BusinessTax';
@@ -1,5 +1,5 @@
1
1
  import { ApiError } from '@etsoo/restclient';
2
- import { IActionResult, IResultData } from './IActionResult';
2
+ import { IActionResult } from './IActionResult';
3
3
 
4
4
  /**
5
5
  * Action result
@@ -9,7 +9,7 @@ export class ActionResult {
9
9
  * Create a result from error
10
10
  * @returns Action result interface
11
11
  */
12
- static create<D extends IResultData = IResultData>(error: Error) {
12
+ static create<D extends {} = {}>(error: Error) {
13
13
  // If the error is ApiError, hold the status
14
14
  const status = error instanceof ApiError ? error.status : undefined;
15
15
 
@@ -1,20 +1,4 @@
1
- /**
2
- * Result data
3
- * Indexable type
4
- */
5
- export interface IResultData {
6
- readonly [key: string]: any;
7
- }
8
-
9
- /**
10
- * Result data with id, follow this style to extend for specific model
11
- */
12
- export interface IdResultData extends IResultData {
13
- /**
14
- * Id
15
- */
16
- id: number | string;
17
- }
1
+ import { DataTypes } from '@etsoo/shared';
18
2
 
19
3
  /**
20
4
  * Result errors
@@ -27,7 +11,7 @@ export interface IResultErrors {
27
11
  /**
28
12
  * Operation result interface
29
13
  */
30
- export interface IActionResult<D extends IResultData = IResultData> {
14
+ export interface IActionResult<D extends {} = {}> {
31
15
  /**
32
16
  * Status code
33
17
  */
@@ -77,4 +61,12 @@ export interface IActionResult<D extends IResultData = IResultData> {
77
61
  /**
78
62
  * Action result with id data
79
63
  */
80
- export type ActionResultId = IActionResult<IdResultData>;
64
+ export type IdActionResult<T extends DataTypes.IdType = number> =
65
+ IActionResult<{
66
+ id: T;
67
+ }>;
68
+
69
+ /**
70
+ * Action result with dynamic data
71
+ */
72
+ export type DynamicActionResult = IActionResult<Record<string, any>>;
@@ -1,9 +1,9 @@
1
- import { IActionResult, IResultData } from './IActionResult';
1
+ import { IActionResult } from './IActionResult';
2
2
 
3
3
  /**
4
4
  * Init call result data
5
5
  */
6
- export interface InitCallResultData extends IResultData {
6
+ export interface InitCallResultData {
7
7
  /**
8
8
  * Device id
9
9
  */
@@ -1,7 +0,0 @@
1
- import { IBridge } from './IBridge';
2
- /**
3
- * Electron bridge class
4
- * copes with preload.js, contextBridge.exposeInMainWorld
5
- * BrowserWindow.webPreferences, contextIsolation: true
6
- */
7
- export declare const AppRuntime: IBridge;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppRuntime = void 0;
4
- /**
5
- * Electron bridge class
6
- * copes with preload.js, contextBridge.exposeInMainWorld
7
- * BrowserWindow.webPreferences, contextIsolation: true
8
- */
9
- exports.AppRuntime = globalThis.appRuntime;
@@ -1,17 +0,0 @@
1
- /**
2
- * Bridge App Data interface
3
- */
4
- export interface IAppData {
5
- /**
6
- * Application name
7
- */
8
- name: string;
9
- /**
10
- * Application version
11
- */
12
- version: string;
13
- /**
14
- * Application path
15
- */
16
- path: string;
17
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * IBridge unsubscribe type
3
- */
4
- declare type IBridgeUnsubscribe = () => void;
5
- /**
6
- * IBridge subscribe listener type
7
- */
8
- declare type IBridgeListener = (...args: any[]) => void;
9
- /**
10
- * window.external calls bridge interface
11
- */
12
- export interface IBridge {
13
- /**
14
- * Send data to the host process with an unique channel
15
- * @param channel an unique channel
16
- * @param data Data to send
17
- */
18
- send(channel: string, data?: any): void;
19
- /**
20
- * Subscribe to the host process
21
- * @param channel an unique channel
22
- * @param listener callback listener
23
- */
24
- subscribe(channel: string, listener: IBridgeListener): IBridgeUnsubscribe;
25
- }
26
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import { IBridge } from './IBridge';
2
- /**
3
- * Electron bridge class
4
- * copes with preload.js, contextBridge.exposeInMainWorld
5
- * BrowserWindow.webPreferences, contextIsolation: true
6
- */
7
- export declare const AppRuntime: IBridge;
@@ -1,6 +0,0 @@
1
- /**
2
- * Electron bridge class
3
- * copes with preload.js, contextBridge.exposeInMainWorld
4
- * BrowserWindow.webPreferences, contextIsolation: true
5
- */
6
- export const AppRuntime = globalThis.appRuntime;
@@ -1,17 +0,0 @@
1
- /**
2
- * Bridge App Data interface
3
- */
4
- export interface IAppData {
5
- /**
6
- * Application name
7
- */
8
- name: string;
9
- /**
10
- * Application version
11
- */
12
- version: string;
13
- /**
14
- * Application path
15
- */
16
- path: string;
17
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * IBridge unsubscribe type
3
- */
4
- declare type IBridgeUnsubscribe = () => void;
5
- /**
6
- * IBridge subscribe listener type
7
- */
8
- declare type IBridgeListener = (...args: any[]) => void;
9
- /**
10
- * window.external calls bridge interface
11
- */
12
- export interface IBridge {
13
- /**
14
- * Send data to the host process with an unique channel
15
- * @param channel an unique channel
16
- * @param data Data to send
17
- */
18
- send(channel: string, data?: any): void;
19
- /**
20
- * Subscribe to the host process
21
- * @param channel an unique channel
22
- * @param listener callback listener
23
- */
24
- subscribe(channel: string, listener: IBridgeListener): IBridgeUnsubscribe;
25
- }
26
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { IBridge } from './IBridge';
2
-
3
- /**
4
- * Electron bridge class
5
- * copes with preload.js, contextBridge.exposeInMainWorld
6
- * BrowserWindow.webPreferences, contextIsolation: true
7
- */
8
- export const AppRuntime = (globalThis as any).appRuntime as IBridge;
@@ -1,19 +0,0 @@
1
- /**
2
- * Bridge App Data interface
3
- */
4
- export interface IAppData {
5
- /**
6
- * Application name
7
- */
8
- name: string;
9
-
10
- /**
11
- * Application version
12
- */
13
- version: string;
14
-
15
- /**
16
- * Application path
17
- */
18
- path: string;
19
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * IBridge unsubscribe type
3
- */
4
- type IBridgeUnsubscribe = () => void;
5
-
6
- /**
7
- * IBridge subscribe listener type
8
- */
9
- type IBridgeListener = (...args: any[]) => void;
10
-
11
- /**
12
- * window.external calls bridge interface
13
- */
14
- export interface IBridge {
15
- /**
16
- * Send data to the host process with an unique channel
17
- * @param channel an unique channel
18
- * @param data Data to send
19
- */
20
- send(channel: string, data?: any): void;
21
-
22
- /**
23
- * Subscribe to the host process
24
- * @param channel an unique channel
25
- * @param listener callback listener
26
- */
27
- subscribe(channel: string, listener: IBridgeListener): IBridgeUnsubscribe;
28
- }