emr-bridge 1.7.0 → 2.0.0
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/LICENCE +1 -1
- package/README.md +173 -366
- package/cjs/entries/index.d.ts +1 -0
- package/cjs/entries/index.js +6 -0
- package/cjs/entries/main.d.ts +2 -0
- package/cjs/entries/main.js +27 -0
- package/cjs/entries/preload.d.ts +3 -0
- package/cjs/entries/preload.js +29 -0
- package/cjs/entries/renderer.d.ts +2 -0
- package/cjs/entries/renderer.js +27 -0
- package/cjs/enums.d.ts +5 -14
- package/cjs/enums.js +12 -23
- package/cjs/errors.d.ts +42 -10
- package/cjs/errors.js +77 -23
- package/cjs/index.d.ts +4 -4
- package/cjs/index.js +14 -16
- package/cjs/main.d.ts +2 -4
- package/cjs/main.js +7 -16
- package/cjs/preload.d.ts +3 -3
- package/cjs/preload.js +5 -5
- package/cjs/renderer.d.ts +2 -2
- package/cjs/renderer.js +2 -2
- package/cjs/scripts/base-bridge.d.ts +95 -0
- package/cjs/scripts/base-bridge.js +128 -0
- package/cjs/scripts/bridge.d.ts +3 -3
- package/cjs/scripts/bridge.js +51 -39
- package/cjs/scripts/helpers/env.d.ts +19 -0
- package/cjs/scripts/helpers/env.js +28 -0
- package/cjs/scripts/helpers/error-thrower.d.ts +3 -0
- package/cjs/scripts/helpers/error-thrower.js +8 -0
- package/cjs/scripts/helpers/errors.d.ts +12 -0
- package/cjs/scripts/helpers/errors.js +17 -0
- package/cjs/scripts/helpers/id.d.ts +9 -0
- package/cjs/scripts/helpers/id.js +14 -0
- package/cjs/scripts/helpers/index.d.ts +8 -0
- package/cjs/scripts/helpers/index.js +22 -0
- package/cjs/scripts/helpers/ipc-channel.d.ts +75 -0
- package/cjs/scripts/helpers/ipc-channel.js +78 -0
- package/cjs/scripts/helpers/ipc-event-in-main.d.ts +24 -0
- package/cjs/scripts/helpers/ipc-event-in-main.js +30 -0
- package/cjs/scripts/helpers/ipc-result.d.ts +26 -0
- package/cjs/scripts/helpers/ipc-result.js +48 -0
- package/cjs/scripts/helpers/main-event.d.ts +8 -0
- package/cjs/scripts/helpers/main-event.js +15 -0
- package/cjs/scripts/helpers/transfer.d.ts +33 -0
- package/cjs/scripts/helpers/transfer.js +57 -0
- package/cjs/scripts/helpers/web-contents-container.d.ts +12 -0
- package/cjs/scripts/helpers/web-contents-container.js +34 -0
- package/cjs/scripts/helpers/web-contents-events-container.d.ts +56 -0
- package/cjs/scripts/helpers/web-contents-events-container.js +81 -0
- package/cjs/scripts/main/publish.d.ts +36 -0
- package/cjs/scripts/main/publish.js +186 -0
- package/cjs/scripts/preload/bridge.d.ts +27 -0
- package/cjs/scripts/preload/bridge.js +85 -0
- package/cjs/scripts/preload/provider.d.ts +7 -0
- package/cjs/scripts/preload/provider.js +89 -0
- package/cjs/scripts/preload-bridge.d.ts +20 -0
- package/cjs/scripts/preload-bridge.js +76 -0
- package/cjs/scripts/preload-provider.js +37 -53
- package/cjs/scripts/provider.d.ts +17 -15
- package/cjs/scripts/provider.js +70 -91
- package/cjs/scripts/publish.d.ts +19 -18
- package/cjs/scripts/publish.js +97 -175
- package/cjs/scripts/renderer/bridge.d.ts +6 -0
- package/cjs/scripts/renderer/bridge.js +74 -0
- package/cjs/scripts/renderer/tunnels.d.ts +171 -0
- package/cjs/scripts/renderer/tunnels.js +205 -0
- package/cjs/scripts/renderer-tunnels.d.ts +19 -21
- package/cjs/scripts/renderer-tunnels.js +53 -58
- package/cjs/types.d.ts +189 -64
- package/esm/entries/index.d.ts +1 -0
- package/esm/entries/index.js +5 -0
- package/esm/entries/main.d.ts +2 -0
- package/esm/entries/main.js +5 -0
- package/esm/entries/preload.d.ts +3 -0
- package/esm/entries/preload.js +7 -0
- package/esm/entries/renderer.d.ts +2 -0
- package/esm/entries/renderer.js +6 -0
- package/esm/enums.d.ts +5 -14
- package/esm/enums.js +11 -22
- package/esm/errors.d.ts +42 -10
- package/esm/errors.js +69 -16
- package/esm/helpers.d.ts +41 -0
- package/esm/helpers.js +96 -0
- package/esm/index.d.ts +4 -4
- package/esm/index.js +3 -3
- package/esm/main.d.ts +2 -4
- package/esm/main.js +1 -3
- package/esm/preload.d.ts +3 -3
- package/esm/preload.js +2 -2
- package/esm/renderer.d.ts +2 -2
- package/esm/renderer.js +1 -1
- package/esm/scripts/base-bridge.d.ts +95 -0
- package/esm/scripts/base-bridge.js +125 -0
- package/esm/scripts/bridge.d.ts +3 -3
- package/esm/scripts/bridge.js +50 -38
- package/esm/scripts/helpers/electron-importer.d.ts +4 -0
- package/esm/scripts/helpers/electron-importer.js +16 -0
- package/esm/scripts/helpers/env.d.ts +19 -0
- package/esm/scripts/helpers/env.js +25 -0
- package/esm/scripts/helpers/error-thrower.d.ts +3 -0
- package/esm/scripts/helpers/error-thrower.js +5 -0
- package/esm/scripts/helpers/errors.d.ts +12 -0
- package/esm/scripts/helpers/errors.js +14 -0
- package/esm/scripts/helpers/id.d.ts +9 -0
- package/esm/scripts/helpers/id.js +11 -0
- package/esm/scripts/helpers/index.d.ts +8 -0
- package/esm/scripts/helpers/index.js +8 -0
- package/esm/scripts/helpers/ipc-channel.d.ts +75 -0
- package/esm/scripts/helpers/ipc-channel.js +76 -0
- package/esm/scripts/helpers/ipc-event-in-main.d.ts +24 -0
- package/esm/scripts/helpers/ipc-event-in-main.js +27 -0
- package/esm/scripts/helpers/ipc-result.d.ts +26 -0
- package/esm/scripts/helpers/ipc-result.js +42 -0
- package/esm/scripts/helpers/main-event.d.ts +8 -0
- package/esm/scripts/helpers/main-event.js +12 -0
- package/esm/scripts/helpers/transfer.d.ts +33 -0
- package/esm/scripts/helpers/transfer.js +54 -0
- package/esm/scripts/helpers/web-contents-container.d.ts +12 -0
- package/esm/scripts/helpers/web-contents-container.js +31 -0
- package/esm/scripts/helpers/web-contents-events-container.d.ts +56 -0
- package/esm/scripts/helpers/web-contents-events-container.js +78 -0
- package/esm/scripts/main/publish.d.ts +36 -0
- package/esm/scripts/main/publish.js +179 -0
- package/esm/scripts/main.d.ts +3 -3
- package/esm/scripts/main.js +43 -41
- package/esm/scripts/preload/bridge.d.ts +27 -0
- package/esm/scripts/preload/bridge.js +77 -0
- package/esm/scripts/preload/provider.d.ts +7 -0
- package/esm/scripts/preload/provider.js +84 -0
- package/esm/scripts/preload-bridge.d.ts +20 -0
- package/esm/scripts/preload-bridge.js +68 -0
- package/esm/scripts/preload-provider.js +35 -51
- package/esm/scripts/provider.d.ts +17 -15
- package/esm/scripts/provider.js +70 -91
- package/esm/scripts/publish.d.ts +19 -18
- package/esm/scripts/publish.js +89 -162
- package/esm/scripts/renderer/bridge.d.ts +6 -0
- package/esm/scripts/renderer/bridge.js +69 -0
- package/esm/scripts/renderer/tunnels.d.ts +171 -0
- package/esm/scripts/renderer/tunnels.js +203 -0
- package/esm/scripts/renderer-tunnels.d.ts +19 -21
- package/esm/scripts/renderer-tunnels.js +53 -55
- package/esm/types.d.ts +189 -64
- package/package.json +24 -41
- package/cjs/exp.d.ts +0 -4
- package/cjs/exp.js +0 -19
- package/cjs/scripts/main.d.ts +0 -8
- package/cjs/scripts/main.js +0 -72
- package/cjs/scripts/new-decorators.d.ts +0 -150
- package/cjs/scripts/new-decorators.js +0 -141
- package/cjs/scripts/old-decorators.d.ts +0 -185
- package/cjs/scripts/old-decorators.js +0 -132
- package/esm/exp.d.ts +0 -4
- package/esm/exp.js +0 -3
- package/esm/scripts/new-decorators.d.ts +0 -150
- package/esm/scripts/new-decorators.js +0 -132
- package/esm/scripts/old-decorators.d.ts +0 -185
- package/esm/scripts/old-decorators.js +0 -122
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.providePublic = exports.publicProperty = exports.publicStaticProperty = exports.publicClassRendererEvent = exports.publicClassMainEvent = exports.publicMethod = exports.publicStaticMethod = void 0;
|
|
4
|
-
const publish_1 = require("./publish");
|
|
5
|
-
function publicStaticMethod(arg) {
|
|
6
|
-
return (target, key) => {
|
|
7
|
-
let name = String(key);
|
|
8
|
-
if (arg) {
|
|
9
|
-
if (typeof arg === 'string') {
|
|
10
|
-
name = arg;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
name = arg.name ?? String(key);
|
|
14
|
-
if (arg.scope)
|
|
15
|
-
(0, publish_1.addScope)(name, arg.scope);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
(0, publish_1.publicFunction)(name, (...args) => target[key](...args));
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
exports.publicStaticMethod = publicStaticMethod;
|
|
22
|
-
function publicMethod(arg) {
|
|
23
|
-
return (tgt, key, _) => {
|
|
24
|
-
const target = tgt;
|
|
25
|
-
const prevRegister = target.__register__ ?? (() => { });
|
|
26
|
-
target.__register__ = instance => {
|
|
27
|
-
prevRegister(instance);
|
|
28
|
-
publicStaticMethod(arg)(instance, key, _);
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.publicMethod = publicMethod;
|
|
33
|
-
function publicClassMainEvent(arg) {
|
|
34
|
-
return (tgt, key, _) => {
|
|
35
|
-
const target = tgt;
|
|
36
|
-
const prevRegister = target.__register__ ?? (() => { });
|
|
37
|
-
target.__register__ = instance => {
|
|
38
|
-
prevRegister(instance);
|
|
39
|
-
let name = String(key);
|
|
40
|
-
if (arg) {
|
|
41
|
-
if (typeof arg === 'string') {
|
|
42
|
-
name = arg;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
name = arg.name ?? String(key);
|
|
46
|
-
if (arg.scope)
|
|
47
|
-
(0, publish_1.addScope)(name, arg.scope);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
instance[key] = (0, publish_1.publicMainEvent)(name, instance[key].bind(instance));
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
exports.publicClassMainEvent = publicClassMainEvent;
|
|
55
|
-
function publicClassRendererEvent(arg) {
|
|
56
|
-
return (tgt, key) => {
|
|
57
|
-
const target = tgt;
|
|
58
|
-
const prevRegister = target.__register__ ?? (() => { });
|
|
59
|
-
target.__register__ = instance => {
|
|
60
|
-
prevRegister(instance);
|
|
61
|
-
let name = String(key);
|
|
62
|
-
let receiver = (v) => v;
|
|
63
|
-
if (arg) {
|
|
64
|
-
if (typeof arg === 'string') {
|
|
65
|
-
name = arg;
|
|
66
|
-
}
|
|
67
|
-
else if (typeof arg === 'object') {
|
|
68
|
-
name = arg.name ?? String(key);
|
|
69
|
-
receiver = arg.procFn ?? receiver;
|
|
70
|
-
if (arg.scope)
|
|
71
|
-
(0, publish_1.addScope)(name, arg.scope);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
receiver = arg;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
instance[key] = (0, publish_1.publicRendererEvent)(name, receiver);
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
exports.publicClassRendererEvent = publicClassRendererEvent;
|
|
82
|
-
function publicStaticProperty(arg) {
|
|
83
|
-
return (target, key) => {
|
|
84
|
-
let name = String(key);
|
|
85
|
-
if (arg) {
|
|
86
|
-
if (typeof arg === 'string') {
|
|
87
|
-
name = arg;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
name = arg.name ?? String(key);
|
|
91
|
-
if (arg.scope)
|
|
92
|
-
(0, publish_1.addScope)(name, arg.scope);
|
|
93
|
-
if (arg.access)
|
|
94
|
-
(0, publish_1.addAccess)(name, arg.access);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
(0, publish_1.publicVariable)(name, {
|
|
98
|
-
get() {
|
|
99
|
-
return target[key];
|
|
100
|
-
},
|
|
101
|
-
set(value) {
|
|
102
|
-
target[key] = value;
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
exports.publicStaticProperty = publicStaticProperty;
|
|
108
|
-
function publicProperty(arg) {
|
|
109
|
-
return (tgt, key) => {
|
|
110
|
-
const target = tgt;
|
|
111
|
-
const prevRegister = target.__register__ ?? (() => { });
|
|
112
|
-
target.__register__ = instance => {
|
|
113
|
-
prevRegister(instance);
|
|
114
|
-
publicStaticProperty(arg)(instance, key);
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
exports.publicProperty = publicProperty;
|
|
119
|
-
/**
|
|
120
|
-
* Binds all public entities of a class to a specific instance.
|
|
121
|
-
*
|
|
122
|
-
* _only for class instance_
|
|
123
|
-
*/
|
|
124
|
-
function providePublic(instance) {
|
|
125
|
-
const target = instance;
|
|
126
|
-
if (!target.__register__)
|
|
127
|
-
throw new Error('Public methods not defined');
|
|
128
|
-
target.__register__(instance);
|
|
129
|
-
target.__register__ = undefined;
|
|
130
|
-
return instance;
|
|
131
|
-
}
|
|
132
|
-
exports.providePublic = providePublic;
|
package/esm/exp.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { Access, Scope } from './enums';
|
|
2
|
-
export { providePublic, publicClassMainEvent, publicClassRendererEvent, publicMethod, publicProperty, publicStaticMethod, publicStaticProperty } from './scripts/old-decorators';
|
|
3
|
-
export { publicFunction, publicMainEvent, publicRendererEvent, publicVariable } from './scripts/publish';
|
|
4
|
-
export type { EventEmitter, EventHandler, EventReceiver, EventUnsubscriber, MainEvent, PublicFunction, PublicProperty, PublishMainEventArgs, PublishMethodArgs, PublishPropertyArgs, PublishRendererEventArgs, RendererEvent } from './types';
|
package/esm/exp.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { Access, Scope } from './enums';
|
|
2
|
-
export { providePublic, publicClassMainEvent, publicClassRendererEvent, publicMethod, publicProperty, publicStaticMethod, publicStaticProperty } from './scripts/old-decorators';
|
|
3
|
-
export { publicFunction, publicMainEvent, publicRendererEvent, publicVariable } from './scripts/publish';
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { ClassGetterDecorator, ClassMethodDecorator, ClassPropertyDecorator, ClassSetterDecorator, EventReceiver, PublishGetterArgs, PublishMainEventArgs, PublishMethodArgs, PublishPropertyArgs, PublishRendererEventArgs, PublishSetterArgs } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
4
|
-
*
|
|
5
|
-
* _only new decorators_
|
|
6
|
-
*/
|
|
7
|
-
export declare function publicMethod(): ClassMethodDecorator;
|
|
8
|
-
/**
|
|
9
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
10
|
-
*
|
|
11
|
-
* _only new decorators_
|
|
12
|
-
*
|
|
13
|
-
* @param name - name by which the method will be accessed
|
|
14
|
-
*/
|
|
15
|
-
export declare function publicMethod(name: string): ClassMethodDecorator;
|
|
16
|
-
/**
|
|
17
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
18
|
-
*
|
|
19
|
-
* _only new decorators_
|
|
20
|
-
*
|
|
21
|
-
* @param args - publish args
|
|
22
|
-
*/
|
|
23
|
-
export declare function publicMethod(args: PublishMethodArgs): ClassMethodDecorator;
|
|
24
|
-
/**
|
|
25
|
-
* Makes the event available for **renderer** and **preload** processes.
|
|
26
|
-
*
|
|
27
|
-
* _only new decorators_
|
|
28
|
-
*/
|
|
29
|
-
export declare function publicClassMainEvent(): ClassMethodDecorator;
|
|
30
|
-
/**
|
|
31
|
-
* Makes the event available for **renderer** and **preload** processes.
|
|
32
|
-
*
|
|
33
|
-
* _only new decorators_
|
|
34
|
-
*
|
|
35
|
-
* @param name - name by which the event will be accessed
|
|
36
|
-
*/
|
|
37
|
-
export declare function publicClassMainEvent(name: string): ClassMethodDecorator;
|
|
38
|
-
/**
|
|
39
|
-
* Makes the event available for **renderer** and **preload** processes.
|
|
40
|
-
*
|
|
41
|
-
* _only new decorators_
|
|
42
|
-
*
|
|
43
|
-
* @param args - publish args
|
|
44
|
-
*/
|
|
45
|
-
export declare function publicClassMainEvent(args: PublishMainEventArgs): ClassMethodDecorator;
|
|
46
|
-
/**
|
|
47
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
48
|
-
*
|
|
49
|
-
* _only new decorators_
|
|
50
|
-
*/
|
|
51
|
-
export declare function publicClassRendererEvent(): ClassPropertyDecorator;
|
|
52
|
-
/**
|
|
53
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
54
|
-
*
|
|
55
|
-
* _only new decorators_
|
|
56
|
-
*
|
|
57
|
-
* @param name - name by which the event will be accessed
|
|
58
|
-
*/
|
|
59
|
-
export declare function publicClassRendererEvent(name: string): ClassPropertyDecorator;
|
|
60
|
-
/**
|
|
61
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
62
|
-
*
|
|
63
|
-
* _only new decorators_
|
|
64
|
-
*
|
|
65
|
-
* @param receiver - linked receiver
|
|
66
|
-
*/
|
|
67
|
-
export declare function publicClassRendererEvent(receiver: EventReceiver): ClassPropertyDecorator;
|
|
68
|
-
/**
|
|
69
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
70
|
-
*
|
|
71
|
-
* * _only new decorators_
|
|
72
|
-
*
|
|
73
|
-
* @param name - name by which the event will be accessed
|
|
74
|
-
* @param receiver - linked receiver
|
|
75
|
-
*/
|
|
76
|
-
export declare function publicClassRendererEvent(name: string, receiver: EventReceiver): ClassPropertyDecorator;
|
|
77
|
-
/**
|
|
78
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
79
|
-
*
|
|
80
|
-
* _only new decorators_
|
|
81
|
-
*
|
|
82
|
-
* @param args - publish args
|
|
83
|
-
*/
|
|
84
|
-
export declare function publicClassRendererEvent(args: PublishRendererEventArgs): ClassPropertyDecorator;
|
|
85
|
-
/**
|
|
86
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
87
|
-
*
|
|
88
|
-
* _only new decorators_
|
|
89
|
-
*/
|
|
90
|
-
export declare function publicProperty(): ClassPropertyDecorator;
|
|
91
|
-
/**
|
|
92
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
93
|
-
*
|
|
94
|
-
* _only new decorators_
|
|
95
|
-
*
|
|
96
|
-
* @param name - name by which the property will be accessed
|
|
97
|
-
*/
|
|
98
|
-
export declare function publicProperty(name: string): ClassPropertyDecorator;
|
|
99
|
-
/**
|
|
100
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
101
|
-
*
|
|
102
|
-
* _only new decorators_
|
|
103
|
-
*
|
|
104
|
-
* @param args - publish args
|
|
105
|
-
*/
|
|
106
|
-
export declare function publicProperty(args: PublishPropertyArgs): ClassPropertyDecorator;
|
|
107
|
-
/**
|
|
108
|
-
* Makes the property getter available for **renderer** and **preload** processes.
|
|
109
|
-
*
|
|
110
|
-
* _only new decorators_
|
|
111
|
-
*/
|
|
112
|
-
export declare function publicGetter(): ClassGetterDecorator;
|
|
113
|
-
/**
|
|
114
|
-
* Makes the property getter available for **renderer** and **preload** processes.
|
|
115
|
-
*
|
|
116
|
-
* _only new decorators_
|
|
117
|
-
*
|
|
118
|
-
* @param name - name by which the property will be accessed
|
|
119
|
-
*/
|
|
120
|
-
export declare function publicGetter(name: string): ClassGetterDecorator;
|
|
121
|
-
/**
|
|
122
|
-
* Makes the property getter available for **renderer** and **preload** processes.
|
|
123
|
-
*
|
|
124
|
-
* _only new decorators_
|
|
125
|
-
*
|
|
126
|
-
* @param args - publish args
|
|
127
|
-
*/
|
|
128
|
-
export declare function publicGetter(args: PublishGetterArgs): ClassGetterDecorator;
|
|
129
|
-
/**
|
|
130
|
-
* Makes the property setter available for **renderer** and **preload** processes.
|
|
131
|
-
*
|
|
132
|
-
* _only new decorators_
|
|
133
|
-
*/
|
|
134
|
-
export declare function publicSetter(): ClassSetterDecorator;
|
|
135
|
-
/**
|
|
136
|
-
* Makes the property setter available for **renderer** and **preload** processes.
|
|
137
|
-
*
|
|
138
|
-
* _only new decorators_
|
|
139
|
-
*
|
|
140
|
-
* @param name - name by which the property will be accessed
|
|
141
|
-
*/
|
|
142
|
-
export declare function publicSetter(name: string): ClassSetterDecorator;
|
|
143
|
-
/**
|
|
144
|
-
* Makes the property setter available for **renderer** and **preload** processes.
|
|
145
|
-
*
|
|
146
|
-
* _only new decorators_
|
|
147
|
-
*
|
|
148
|
-
* @param args - publish args
|
|
149
|
-
*/
|
|
150
|
-
export declare function publicSetter(args: PublishSetterArgs): ClassSetterDecorator;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { addAccess, addScope, publicFunction, publicMainEvent, publicRendererEvent, publicVariable } from './publish';
|
|
2
|
-
export function publicMethod(arg) {
|
|
3
|
-
return (method, context) => {
|
|
4
|
-
let name = String(context.name);
|
|
5
|
-
if (arg) {
|
|
6
|
-
if (typeof arg === 'string') {
|
|
7
|
-
name = arg;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
name = arg.name ?? name;
|
|
11
|
-
if (arg.scope)
|
|
12
|
-
addScope(name, arg.scope);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
context.addInitializer(function () {
|
|
16
|
-
publicFunction(name, method.bind(this));
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export function publicClassMainEvent(arg) {
|
|
21
|
-
return (method, context) => {
|
|
22
|
-
let name = String(context.name);
|
|
23
|
-
if (arg) {
|
|
24
|
-
if (typeof arg === 'string') {
|
|
25
|
-
name = arg;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
name = arg.name ?? name;
|
|
29
|
-
if (arg.scope)
|
|
30
|
-
addScope(name, arg.scope);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
context.addInitializer(function () {
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
this[context.name] = publicMainEvent(name, method.bind(this));
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export function publicClassRendererEvent(arg) {
|
|
40
|
-
return (_, context) => {
|
|
41
|
-
let name = String(context.name);
|
|
42
|
-
let receiver = (v) => v;
|
|
43
|
-
if (arg) {
|
|
44
|
-
if (typeof arg === 'string') {
|
|
45
|
-
name = arg;
|
|
46
|
-
}
|
|
47
|
-
else if (typeof arg === 'object') {
|
|
48
|
-
name = arg.name ?? String(context.name);
|
|
49
|
-
receiver = arg.procFn ?? receiver;
|
|
50
|
-
if (arg.scope)
|
|
51
|
-
addScope(name, arg.scope);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
receiver = arg;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
context.addInitializer(function () {
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
this[context.name] = publicRendererEvent(name, receiver);
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function publicProperty(arg) {
|
|
64
|
-
return (_, context) => {
|
|
65
|
-
const key = String(context.name);
|
|
66
|
-
let name = key;
|
|
67
|
-
if (arg) {
|
|
68
|
-
if (typeof arg === 'string') {
|
|
69
|
-
name = arg;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
name = arg.name ?? name;
|
|
73
|
-
if (arg.scope)
|
|
74
|
-
addScope(name, arg.scope);
|
|
75
|
-
if (arg.access)
|
|
76
|
-
addAccess(name, arg.access);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
context.addInitializer(function () {
|
|
80
|
-
publicVariable(name, {
|
|
81
|
-
get: () => {
|
|
82
|
-
// @ts-expect-error
|
|
83
|
-
return this[key];
|
|
84
|
-
},
|
|
85
|
-
set: (value) => {
|
|
86
|
-
// @ts-expect-error
|
|
87
|
-
this[key] = value;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
export function publicGetter(arg) {
|
|
94
|
-
return (getter, context) => {
|
|
95
|
-
let name = String(context.name);
|
|
96
|
-
if (arg) {
|
|
97
|
-
if (typeof arg === 'string') {
|
|
98
|
-
name = arg;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
name = arg.name ?? name;
|
|
102
|
-
if (arg.scope)
|
|
103
|
-
addScope(name, arg.scope);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
context.addInitializer(function () {
|
|
107
|
-
publicVariable(name, {
|
|
108
|
-
get: getter.bind(this)
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
export function publicSetter(arg) {
|
|
114
|
-
return (setter, context) => {
|
|
115
|
-
let name = String(context.name);
|
|
116
|
-
if (arg) {
|
|
117
|
-
if (typeof arg === 'string') {
|
|
118
|
-
name = arg;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
name = arg.name ?? name;
|
|
122
|
-
if (arg.scope)
|
|
123
|
-
addScope(name, arg.scope);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
context.addInitializer(function () {
|
|
127
|
-
publicVariable(name, {
|
|
128
|
-
set: setter.bind(this)
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import type { EventReceiver, PublishMainEventArgs, PublishMethodArgs, PublishPropertyArgs, PublishRendererEventArgs } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
4
|
-
*
|
|
5
|
-
* _only for static_
|
|
6
|
-
* _experimental decorators_
|
|
7
|
-
*/
|
|
8
|
-
export declare function publicStaticMethod(): MethodDecorator;
|
|
9
|
-
/**
|
|
10
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
11
|
-
*
|
|
12
|
-
* _only for static_
|
|
13
|
-
* _experimental decorators_
|
|
14
|
-
*
|
|
15
|
-
* @param name - name by which the method will be accessed
|
|
16
|
-
*/
|
|
17
|
-
export declare function publicStaticMethod(name: string): MethodDecorator;
|
|
18
|
-
/**
|
|
19
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
20
|
-
*
|
|
21
|
-
* _only for static_
|
|
22
|
-
* _experimental decorators_
|
|
23
|
-
*
|
|
24
|
-
* @param args - publish args
|
|
25
|
-
*/
|
|
26
|
-
export declare function publicStaticMethod(args: PublishMethodArgs): MethodDecorator;
|
|
27
|
-
/**
|
|
28
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
29
|
-
*
|
|
30
|
-
* _only for non-static_
|
|
31
|
-
* _experimental decorators_
|
|
32
|
-
* _required `providePublic(classInstance)`_
|
|
33
|
-
*/
|
|
34
|
-
export declare function publicMethod(): MethodDecorator;
|
|
35
|
-
/**
|
|
36
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
37
|
-
*
|
|
38
|
-
* _only for non-static_
|
|
39
|
-
* _experimental decorators_
|
|
40
|
-
* _required `providePublic(classInstance)`_
|
|
41
|
-
*
|
|
42
|
-
* @param name - name by which the method will be accessed
|
|
43
|
-
*/
|
|
44
|
-
export declare function publicMethod(name: string): MethodDecorator;
|
|
45
|
-
/**
|
|
46
|
-
* Makes the method available for **renderer** and **preload** processes.
|
|
47
|
-
*
|
|
48
|
-
* _only for non-static_
|
|
49
|
-
* _experimental decorators_
|
|
50
|
-
* _required `providePublic(classInstance)`_
|
|
51
|
-
*
|
|
52
|
-
* @param args - publish args
|
|
53
|
-
*/
|
|
54
|
-
export declare function publicMethod(args: PublishMethodArgs): MethodDecorator;
|
|
55
|
-
/**
|
|
56
|
-
* Makes the event available for **renderer** and **preload** processes.
|
|
57
|
-
*
|
|
58
|
-
* _only for non-static_
|
|
59
|
-
* _experimental decorators_
|
|
60
|
-
* _required `providePublic(classInstance)`_
|
|
61
|
-
*/
|
|
62
|
-
export declare function publicClassMainEvent(): MethodDecorator;
|
|
63
|
-
/**
|
|
64
|
-
* Makes the event available for **renderer** and **preload** processes.
|
|
65
|
-
*
|
|
66
|
-
* _only for non-static_
|
|
67
|
-
* _experimental decorators_
|
|
68
|
-
* _required `providePublic(classInstance)`_
|
|
69
|
-
*
|
|
70
|
-
* @param name - name by which the event will be accessed
|
|
71
|
-
*/
|
|
72
|
-
export declare function publicClassMainEvent(name: string): MethodDecorator;
|
|
73
|
-
/**
|
|
74
|
-
* Makes the event available for **renderer** and **preload** processes.
|
|
75
|
-
*
|
|
76
|
-
* _only for non-static_
|
|
77
|
-
* _experimental decorators_
|
|
78
|
-
* _required `providePublic(classInstance)`_
|
|
79
|
-
*
|
|
80
|
-
* @param args - publish args
|
|
81
|
-
*/
|
|
82
|
-
export declare function publicClassMainEvent(args: PublishMainEventArgs): MethodDecorator;
|
|
83
|
-
/**
|
|
84
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
85
|
-
*
|
|
86
|
-
* _only for non-static_
|
|
87
|
-
* _experimental decorators_
|
|
88
|
-
*/
|
|
89
|
-
export declare function publicClassRendererEvent(): PropertyDecorator;
|
|
90
|
-
/**
|
|
91
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
92
|
-
*
|
|
93
|
-
* _only for non-static_
|
|
94
|
-
* _experimental decorators_
|
|
95
|
-
*
|
|
96
|
-
* @param name - name by which the event will be accessed
|
|
97
|
-
*/
|
|
98
|
-
export declare function publicClassRendererEvent(name: string): PropertyDecorator;
|
|
99
|
-
/**
|
|
100
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
101
|
-
*
|
|
102
|
-
* _only for non-static_
|
|
103
|
-
* _experimental decorators_
|
|
104
|
-
*
|
|
105
|
-
* @param receiver - linked receiver
|
|
106
|
-
*/
|
|
107
|
-
export declare function publicClassRendererEvent(receiver: EventReceiver): PropertyDecorator;
|
|
108
|
-
/**
|
|
109
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
110
|
-
*
|
|
111
|
-
* _only for non-static_
|
|
112
|
-
* _experimental decorators_
|
|
113
|
-
*
|
|
114
|
-
* @param name - name by which the event will be accessed
|
|
115
|
-
* @param receiver - linked receiver
|
|
116
|
-
*/
|
|
117
|
-
export declare function publicClassRendererEvent(name: string, receiver: EventReceiver): PropertyDecorator;
|
|
118
|
-
/**
|
|
119
|
-
* Makes the event from **renderer** and **preload** available for **main** process.
|
|
120
|
-
*
|
|
121
|
-
* _only for non-static_
|
|
122
|
-
* _experimental decorators_
|
|
123
|
-
*
|
|
124
|
-
* @param args - publish args
|
|
125
|
-
*/
|
|
126
|
-
export declare function publicClassRendererEvent(args: PublishRendererEventArgs): PropertyDecorator;
|
|
127
|
-
/**
|
|
128
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
129
|
-
*
|
|
130
|
-
* _only for static_
|
|
131
|
-
* _experimental decorators_
|
|
132
|
-
*/
|
|
133
|
-
export declare function publicStaticProperty(): PropertyDecorator;
|
|
134
|
-
/**
|
|
135
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
136
|
-
*
|
|
137
|
-
* _only for static_
|
|
138
|
-
* _experimental decorators_
|
|
139
|
-
*
|
|
140
|
-
* @param name - name by which the property will be accessed
|
|
141
|
-
*/
|
|
142
|
-
export declare function publicStaticProperty(name: string): PropertyDecorator;
|
|
143
|
-
/**
|
|
144
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
145
|
-
*
|
|
146
|
-
* _only for static_
|
|
147
|
-
* _experimental decorators_
|
|
148
|
-
*
|
|
149
|
-
* @param args - publish args
|
|
150
|
-
*/
|
|
151
|
-
export declare function publicStaticProperty(args: PublishPropertyArgs): PropertyDecorator;
|
|
152
|
-
/**
|
|
153
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
154
|
-
*
|
|
155
|
-
* _only for non-static_
|
|
156
|
-
* _experimental decorators_
|
|
157
|
-
* _required `providePublic(classInstance)`_
|
|
158
|
-
*/
|
|
159
|
-
export declare function publicProperty(): PropertyDecorator;
|
|
160
|
-
/**
|
|
161
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
162
|
-
*
|
|
163
|
-
* _only for non-static_
|
|
164
|
-
* _experimental decorators_
|
|
165
|
-
* _required `providePublic(classInstance)`_
|
|
166
|
-
*
|
|
167
|
-
* @param name - name by which the property will be accessed
|
|
168
|
-
*/
|
|
169
|
-
export declare function publicProperty(name: string): PropertyDecorator;
|
|
170
|
-
/**
|
|
171
|
-
* Makes the property available for **renderer** and **preload** processes.
|
|
172
|
-
*
|
|
173
|
-
* _only for non-static_
|
|
174
|
-
* _experimental decorators_
|
|
175
|
-
* _required `providePublic(classInstance)`_
|
|
176
|
-
*
|
|
177
|
-
* @param args - publish args
|
|
178
|
-
*/
|
|
179
|
-
export declare function publicProperty(args: PublishPropertyArgs): PropertyDecorator;
|
|
180
|
-
/**
|
|
181
|
-
* Binds all public entities of a class to a specific instance.
|
|
182
|
-
*
|
|
183
|
-
* _only for class instance_
|
|
184
|
-
*/
|
|
185
|
-
export declare function providePublic<InstanceType>(instance: InstanceType): InstanceType;
|