@rws-framework/client 2.20.1 → 2.20.2
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/.bin/emerge.sh +15 -15
- package/builder/vite/index.ts +4 -4
- package/builder/vite/rws.vite.config.ts +132 -132
- package/builder/vite/rws_scss_plugin.ts +61 -61
- package/builder/webpack/index.js +10 -10
- package/builder/webpack/rws.webpack.config.js +161 -161
- package/builder/webpack/rws_scss_plugin.js +90 -90
- package/builder/webpack/rws_webpack_plugin.js +137 -137
- package/cfg/_default.cfg.js +26 -26
- package/cfg/_storage.d.ts +22 -22
- package/cfg/_storage.js +42 -42
- package/cfg/tsconfigSetup.js +146 -146
- package/docs/assets/26e93147f10415a0ed4a.svg +6 -6
- package/docs/assets/75c9471662e97ee24f29.svg +7 -7
- package/docs/assets/db90e4df2373980c497d.svg +9 -9
- package/docs/assets/highlight.css +127 -127
- package/docs/assets/main.js +59 -59
- package/docs/assets/style.css +1414 -1414
- package/docs/classes/ApiServiceInstance.html +25 -25
- package/docs/classes/ConfigServiceInstance.html +21 -21
- package/docs/classes/DOMServiceInstance.html +17 -17
- package/docs/classes/NotifyServiceInstance.html +15 -15
- package/docs/classes/RWSClientInstance.html +45 -45
- package/docs/classes/RWSPlugin.html +13 -13
- package/docs/classes/RWSService.html +10 -10
- package/docs/classes/RWSViewComponent.html +1022 -1022
- package/docs/classes/ServiceWorkerServiceInstance.html +13 -13
- package/docs/classes/UtilsServiceInstance.html +13 -13
- package/docs/functions/attr.html +5 -5
- package/docs/functions/observable.html +3 -3
- package/docs/index.html +179 -179
- package/docs/interfaces/HTMLTag.html +3 -3
- package/docs/interfaces/IRWSConfig.html +20 -20
- package/docs/interfaces/IRWSDecoratorOptions.html +5 -5
- package/docs/interfaces/IRWSHttpRoute.html +2 -2
- package/docs/interfaces/IRWSPrefixedHTTProutes.html +2 -2
- package/docs/interfaces/IRWSUser.html +5 -5
- package/docs/modules.html +45 -45
- package/foundation/index.js +1 -1
- package/foundation/rws-foundation.d.ts +7 -7
- package/foundation/rws-foundation.js +7 -7
- package/package.json +1 -1
- package/service_worker/src/_service_worker.ts +83 -83
- package/service_worker/tsconfig.json +20 -20
- package/service_worker/webpack.config.js +66 -66
- package/src/client/components.ts +67 -67
- package/src/client/config.ts +175 -175
- package/src/client/hotReload.ts +22 -22
- package/src/client/services.ts +27 -27
- package/src/client.ts +208 -208
- package/src/components/_component.ts +247 -247
- package/src/components/_container.ts +15 -15
- package/src/components/_decorator.ts +122 -122
- package/src/components/_definitions.ts +64 -64
- package/src/components/_event_handling.ts +40 -40
- package/src/components/index.ts +25 -25
- package/src/index.ts +86 -86
- package/src/plugins/_builder.js +31 -31
- package/src/plugins/_plugin.ts +60 -60
- package/src/services/ApiService.ts +105 -105
- package/src/services/ConfigService.ts +125 -125
- package/src/services/DOMService.ts +93 -93
- package/src/services/NotifyService.ts +47 -47
- package/src/services/ServiceWorkerService.ts +60 -60
- package/src/services/UtilsService.ts +60 -60
- package/src/services/_service.ts +64 -64
- package/src/styles/README.md +157 -157
- package/src/styles/_darkreader.scss +30 -30
- package/src/styles/_grid.scss +75 -75
- package/src/styles/_grid_legacy.scss +49 -49
- package/src/styles/_misc.scss +8 -8
- package/src/styles/_scrollbars.scss +40 -40
- package/src/styles/includes.scss +6 -6
- package/src/types/IBackendCore.ts +11 -11
- package/src/types/IRWSConfig.ts +29 -29
- package/src/types/IRWSPlugin.ts +23 -23
- package/src/types/IRWSResource.ts +4 -4
- package/src/types/IRWSUser.ts +6 -6
- package/src/types/IRWSViewComponent.ts +36 -36
- package/src/types/IReFormerField.ts +4 -4
- package/src/types/RWSNotify.ts +6 -6
- package/src/types/RWSWindow.ts +41 -41
- package/types/declarations.d.ts +8 -8
- package/types/docs-typings.d.ts +15 -15
package/src/client/config.ts
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
import { IRWSConfig, IRWSUser, IStaticRWSPlugin } from "../index";
|
|
2
|
-
import { RWSClientInstance } from "../client";
|
|
3
|
-
|
|
4
|
-
import { RWSPlugin, DefaultRWSPluginOptionsType } from "../plugins/_plugin";
|
|
5
|
-
import RWSWindow, {loadRWSRichWindow } from '../types/RWSWindow';
|
|
6
|
-
import deepmerge from 'deepmerge';
|
|
7
|
-
import { IPluginSpawnOption } from "../types/IRWSPlugin";
|
|
8
|
-
|
|
9
|
-
import { _DEFAULT_HR_PORT } from './hotReload';
|
|
10
|
-
|
|
11
|
-
function getUser(this: RWSClientInstance): IRWSUser {
|
|
12
|
-
|
|
13
|
-
const localSaved = localStorage.getItem('the_rws_user');
|
|
14
|
-
|
|
15
|
-
if (localSaved) {
|
|
16
|
-
this.setUser(JSON.parse(localSaved) as IRWSUser);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return this.user;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function setUser(this: RWSClientInstance, user: IRWSUser): RWSClientInstance {
|
|
23
|
-
if (!user || !user?.jwt_token) {
|
|
24
|
-
console.warn('[RWS Client Warning]', 'Passed user is not valid', user);
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
this.user = user;
|
|
29
|
-
|
|
30
|
-
this.apiService.setToken(this.user.jwt_token);
|
|
31
|
-
|
|
32
|
-
localStorage.setItem('the_rws_user', JSON.stringify(this.user));
|
|
33
|
-
|
|
34
|
-
for(const plugin of RWSPlugin.getAllPlugins()){
|
|
35
|
-
plugin.onSetUser(user);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function pushDataToServiceWorker(this: RWSClientInstance, type: string, data: any, asset_type: string = 'data_push'): void {
|
|
42
|
-
let tries = 0;
|
|
43
|
-
|
|
44
|
-
const doIt: () => void = () => {
|
|
45
|
-
try {
|
|
46
|
-
this.swService.sendDataToServiceWorker(type, data, asset_type);
|
|
47
|
-
} catch (e) {
|
|
48
|
-
if (tries < 3) {
|
|
49
|
-
setTimeout(() => { doIt(); }, 300);
|
|
50
|
-
tries++;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
doIt();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function pushUserToServiceWorker(this: RWSClientInstance, userData: any) {
|
|
59
|
-
this.setUser(userData);
|
|
60
|
-
this.pushDataToServiceWorker('SET_USER', userData, 'logged_user');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function get(this: RWSClientInstance, key: string): any | null
|
|
64
|
-
{
|
|
65
|
-
if(Object.keys(this.customServices).includes(key)){
|
|
66
|
-
return this.customServices[key];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if(Object.keys(this.defaultServices).includes(key)){
|
|
70
|
-
return this.defaultServices[key];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function addPlugin<T extends DefaultRWSPluginOptionsType>(this: RWSClientInstance, pluginEntry: IPluginSpawnOption<T>){
|
|
77
|
-
const rwsWindow: RWSWindow = loadRWSRichWindow();
|
|
78
|
-
const pluginClass: IStaticRWSPlugin<T> = pluginEntry.pluginEntry;
|
|
79
|
-
const pluginOptions: T = (Array.isArray(pluginEntry) ? pluginEntry[1] : { enabled: true }) as T;
|
|
80
|
-
|
|
81
|
-
if(!Object.keys(rwsWindow.RWS.plugins).find(item => { item === pluginClass.name })){
|
|
82
|
-
const pluginInstance: RWSPlugin<T> = new pluginClass(pluginOptions);
|
|
83
|
-
this.plugins[pluginClass.name] = pluginInstance;
|
|
84
|
-
rwsWindow.RWS.plugins[pluginClass.name] = pluginInstance;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async function setup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<IRWSConfig> {
|
|
89
|
-
if (this.isSetup) {
|
|
90
|
-
return this.config;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if(this.config){
|
|
94
|
-
this.config = deepmerge(this.config, config);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
this.appConfig.mergeConfig(this.config);
|
|
98
|
-
|
|
99
|
-
if (this.appConfig.get('hotReload') === true) {
|
|
100
|
-
if(!this.appConfig.get('hotReloadPort')){
|
|
101
|
-
this.appConfig.set('hotReloadPort', _DEFAULT_HR_PORT)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if(this.config.plugins){
|
|
106
|
-
for (const pluginEntry of this.config.plugins){
|
|
107
|
-
addPlugin.bind(this)(pluginEntry);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if(config?.user){
|
|
112
|
-
this.setUser(config.user);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (this.appConfig.get('parted')) {
|
|
116
|
-
const componentParts = await this.loadPartedComponents();
|
|
117
|
-
|
|
118
|
-
for (const plugin of RWSPlugin.getAllPlugins()){
|
|
119
|
-
plugin.onPartedComponentsLoad(componentParts);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
this.isSetup = true;
|
|
124
|
-
return this.config;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<RWSClientInstance> {
|
|
128
|
-
this.config = { ...this.config, ...config };
|
|
129
|
-
|
|
130
|
-
if (!this.isSetup) {
|
|
131
|
-
this.config = await this.setup(this.config);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (Object.keys(config).length) {
|
|
135
|
-
this.appConfig.mergeConfig(this.config);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const setThisUser = config?.user || this.getUser();
|
|
139
|
-
|
|
140
|
-
if(setThisUser){
|
|
141
|
-
this.config.user = setThisUser;
|
|
142
|
-
this.setUser(setThisUser);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (this.config.user && !this.config.dontPushToSW) {
|
|
146
|
-
this.pushUserToServiceWorker(this.user);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
await this.initCallback();
|
|
150
|
-
|
|
151
|
-
for (const plugin of RWSPlugin.getAllPlugins()){
|
|
152
|
-
await plugin.onClientStart();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// if(this.appConfig.get('hotReload')){
|
|
156
|
-
// if (module.hot) {
|
|
157
|
-
// module.hot.accept();
|
|
158
|
-
// }
|
|
159
|
-
// }
|
|
160
|
-
|
|
161
|
-
return this;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function getBinds(this: RWSClientInstance) {
|
|
165
|
-
return {
|
|
166
|
-
start: start.bind(this),
|
|
167
|
-
setup: setup.bind(this),
|
|
168
|
-
get: get.bind(this),
|
|
169
|
-
setUser: setUser.bind(this),
|
|
170
|
-
getUser: getUser.bind(this),
|
|
171
|
-
pushDataToServiceWorker: pushDataToServiceWorker.bind(this),
|
|
172
|
-
pushUserToServiceWorker: pushUserToServiceWorker.bind(this)
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
1
|
+
import { IRWSConfig, IRWSUser, IStaticRWSPlugin } from "../index";
|
|
2
|
+
import { RWSClientInstance } from "../client";
|
|
3
|
+
|
|
4
|
+
import { RWSPlugin, DefaultRWSPluginOptionsType } from "../plugins/_plugin";
|
|
5
|
+
import RWSWindow, {loadRWSRichWindow } from '../types/RWSWindow';
|
|
6
|
+
import deepmerge from 'deepmerge';
|
|
7
|
+
import { IPluginSpawnOption } from "../types/IRWSPlugin";
|
|
8
|
+
|
|
9
|
+
import { _DEFAULT_HR_PORT } from './hotReload';
|
|
10
|
+
|
|
11
|
+
function getUser(this: RWSClientInstance): IRWSUser {
|
|
12
|
+
|
|
13
|
+
const localSaved = localStorage.getItem('the_rws_user');
|
|
14
|
+
|
|
15
|
+
if (localSaved) {
|
|
16
|
+
this.setUser(JSON.parse(localSaved) as IRWSUser);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return this.user;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function setUser(this: RWSClientInstance, user: IRWSUser): RWSClientInstance {
|
|
23
|
+
if (!user || !user?.jwt_token) {
|
|
24
|
+
console.warn('[RWS Client Warning]', 'Passed user is not valid', user);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
this.user = user;
|
|
29
|
+
|
|
30
|
+
this.apiService.setToken(this.user.jwt_token);
|
|
31
|
+
|
|
32
|
+
localStorage.setItem('the_rws_user', JSON.stringify(this.user));
|
|
33
|
+
|
|
34
|
+
for(const plugin of RWSPlugin.getAllPlugins()){
|
|
35
|
+
plugin.onSetUser(user);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function pushDataToServiceWorker(this: RWSClientInstance, type: string, data: any, asset_type: string = 'data_push'): void {
|
|
42
|
+
let tries = 0;
|
|
43
|
+
|
|
44
|
+
const doIt: () => void = () => {
|
|
45
|
+
try {
|
|
46
|
+
this.swService.sendDataToServiceWorker(type, data, asset_type);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
if (tries < 3) {
|
|
49
|
+
setTimeout(() => { doIt(); }, 300);
|
|
50
|
+
tries++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
doIt();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function pushUserToServiceWorker(this: RWSClientInstance, userData: any) {
|
|
59
|
+
this.setUser(userData);
|
|
60
|
+
this.pushDataToServiceWorker('SET_USER', userData, 'logged_user');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function get(this: RWSClientInstance, key: string): any | null
|
|
64
|
+
{
|
|
65
|
+
if(Object.keys(this.customServices).includes(key)){
|
|
66
|
+
return this.customServices[key];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if(Object.keys(this.defaultServices).includes(key)){
|
|
70
|
+
return this.defaultServices[key];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function addPlugin<T extends DefaultRWSPluginOptionsType>(this: RWSClientInstance, pluginEntry: IPluginSpawnOption<T>){
|
|
77
|
+
const rwsWindow: RWSWindow = loadRWSRichWindow();
|
|
78
|
+
const pluginClass: IStaticRWSPlugin<T> = pluginEntry.pluginEntry;
|
|
79
|
+
const pluginOptions: T = (Array.isArray(pluginEntry) ? pluginEntry[1] : { enabled: true }) as T;
|
|
80
|
+
|
|
81
|
+
if(!Object.keys(rwsWindow.RWS.plugins).find(item => { item === pluginClass.name })){
|
|
82
|
+
const pluginInstance: RWSPlugin<T> = new pluginClass(pluginOptions);
|
|
83
|
+
this.plugins[pluginClass.name] = pluginInstance;
|
|
84
|
+
rwsWindow.RWS.plugins[pluginClass.name] = pluginInstance;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function setup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<IRWSConfig> {
|
|
89
|
+
if (this.isSetup) {
|
|
90
|
+
return this.config;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if(this.config){
|
|
94
|
+
this.config = deepmerge(this.config, config);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.appConfig.mergeConfig(this.config);
|
|
98
|
+
|
|
99
|
+
if (this.appConfig.get('hotReload') === true) {
|
|
100
|
+
if(!this.appConfig.get('hotReloadPort')){
|
|
101
|
+
this.appConfig.set('hotReloadPort', _DEFAULT_HR_PORT)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if(this.config.plugins){
|
|
106
|
+
for (const pluginEntry of this.config.plugins){
|
|
107
|
+
addPlugin.bind(this)(pluginEntry);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if(config?.user){
|
|
112
|
+
this.setUser(config.user);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this.appConfig.get('parted')) {
|
|
116
|
+
const componentParts = await this.loadPartedComponents();
|
|
117
|
+
|
|
118
|
+
for (const plugin of RWSPlugin.getAllPlugins()){
|
|
119
|
+
plugin.onPartedComponentsLoad(componentParts);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this.isSetup = true;
|
|
124
|
+
return this.config;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<RWSClientInstance> {
|
|
128
|
+
this.config = { ...this.config, ...config };
|
|
129
|
+
|
|
130
|
+
if (!this.isSetup) {
|
|
131
|
+
this.config = await this.setup(this.config);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (Object.keys(config).length) {
|
|
135
|
+
this.appConfig.mergeConfig(this.config);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const setThisUser = config?.user || this.getUser();
|
|
139
|
+
|
|
140
|
+
if(setThisUser){
|
|
141
|
+
this.config.user = setThisUser;
|
|
142
|
+
this.setUser(setThisUser);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (this.config.user && !this.config.dontPushToSW) {
|
|
146
|
+
this.pushUserToServiceWorker(this.user);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
await this.initCallback();
|
|
150
|
+
|
|
151
|
+
for (const plugin of RWSPlugin.getAllPlugins()){
|
|
152
|
+
await plugin.onClientStart();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// if(this.appConfig.get('hotReload')){
|
|
156
|
+
// if (module.hot) {
|
|
157
|
+
// module.hot.accept();
|
|
158
|
+
// }
|
|
159
|
+
// }
|
|
160
|
+
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function getBinds(this: RWSClientInstance) {
|
|
165
|
+
return {
|
|
166
|
+
start: start.bind(this),
|
|
167
|
+
setup: setup.bind(this),
|
|
168
|
+
get: get.bind(this),
|
|
169
|
+
setUser: setUser.bind(this),
|
|
170
|
+
getUser: getUser.bind(this),
|
|
171
|
+
pushDataToServiceWorker: pushDataToServiceWorker.bind(this),
|
|
172
|
+
pushUserToServiceWorker: pushUserToServiceWorker.bind(this)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
176
|
export default getBinds;
|
package/src/client/hotReload.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { RWSClientInstance } from "../client";
|
|
2
|
-
import IRWSConfig from "../types/IRWSConfig";
|
|
3
|
-
|
|
4
|
-
export const _DEFAULT_HR_PORT = 1030;
|
|
5
|
-
|
|
6
|
-
export interface IHotReloadCfg {
|
|
7
|
-
enabled: boolean,
|
|
8
|
-
port: number
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function hotReloadSetup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<RWSClientInstance>
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getBinds(this: RWSClientInstance) {
|
|
18
|
-
return {
|
|
19
|
-
hotReloadSetup: hotReloadSetup.bind(this)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
1
|
+
import { RWSClientInstance } from "../client";
|
|
2
|
+
import IRWSConfig from "../types/IRWSConfig";
|
|
3
|
+
|
|
4
|
+
export const _DEFAULT_HR_PORT = 1030;
|
|
5
|
+
|
|
6
|
+
export interface IHotReloadCfg {
|
|
7
|
+
enabled: boolean,
|
|
8
|
+
port: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function hotReloadSetup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<RWSClientInstance>
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getBinds(this: RWSClientInstance) {
|
|
18
|
+
return {
|
|
19
|
+
hotReloadSetup: hotReloadSetup.bind(this)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
23
|
export default getBinds;
|
package/src/client/services.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { loadRWSRichWindow } from "../types/RWSWindow";
|
|
2
|
-
import { RWSClientInstance } from "../client";
|
|
3
|
-
type RWSInfoType = { components: string[] };
|
|
4
|
-
|
|
5
|
-
async function loadServices(this: RWSClientInstance){
|
|
6
|
-
const richWindow = loadRWSRichWindow();
|
|
7
|
-
|
|
8
|
-
for (const serviceKey of Object.keys(richWindow.RWS._registered)){
|
|
9
|
-
const currentService = this._container.get(richWindow.RWS._registered[serviceKey]);
|
|
10
|
-
|
|
11
|
-
if(currentService.isInClient() && !Object.keys(this.customServices).includes(serviceKey)){
|
|
12
|
-
this.customServices[serviceKey] = currentService;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if(currentService.isDefault() && !Object.keys(this.defaultServices).includes(serviceKey)){
|
|
16
|
-
this.defaultServices[serviceKey] = currentService;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function getBinds(this: RWSClientInstance){
|
|
23
|
-
return {
|
|
24
|
-
loadServices: loadServices.bind(this),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
1
|
+
import { loadRWSRichWindow } from "../types/RWSWindow";
|
|
2
|
+
import { RWSClientInstance } from "../client";
|
|
3
|
+
type RWSInfoType = { components: string[] };
|
|
4
|
+
|
|
5
|
+
async function loadServices(this: RWSClientInstance){
|
|
6
|
+
const richWindow = loadRWSRichWindow();
|
|
7
|
+
|
|
8
|
+
for (const serviceKey of Object.keys(richWindow.RWS._registered)){
|
|
9
|
+
const currentService = this._container.get(richWindow.RWS._registered[serviceKey]);
|
|
10
|
+
|
|
11
|
+
if(currentService.isInClient() && !Object.keys(this.customServices).includes(serviceKey)){
|
|
12
|
+
this.customServices[serviceKey] = currentService;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if(currentService.isDefault() && !Object.keys(this.defaultServices).includes(serviceKey)){
|
|
16
|
+
this.defaultServices[serviceKey] = currentService;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
function getBinds(this: RWSClientInstance){
|
|
23
|
+
return {
|
|
24
|
+
loadServices: loadServices.bind(this),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
28
|
export default getBinds;
|