@rws-framework/client 2.6.3 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.6.3",
4
+ "version": "2.6.4",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -8,17 +8,27 @@ async function loadPartedComponents(this: RWSClientInstance): Promise<void> {
8
8
 
9
9
  const componentParts: RWSInfoType = await this.apiService.get<RWSInfoType>(this.appConfig.get('partedDirUrlPrefix') + '/rws_info.json');
10
10
 
11
+ const componentsPromises: Promise<string>[] = [];
12
+
11
13
  componentParts.components.forEach((componentName: string, key: number) => {
12
14
  const partUrl = `${this.appConfig.get('partedDirUrlPrefix')}/${this.appConfig.get('partedPrefix')}.${componentName}.js`;
15
+ componentsPromises.push(this.apiService.pureGet(partUrl, {
16
+ headers: {
17
+ 'Content-Type': 'script'
18
+ } as any
19
+ }));
20
+ console.log(`Appended ${componentParts.components[key]} component (${partUrl})`);
21
+
22
+ });
23
+
24
+ const downloadedComponents = await Promise.all(componentsPromises);
13
25
 
26
+ downloadedComponents.forEach((componentCode: string, key: number) => {
14
27
  const script: HTMLScriptElement = document.createElement('script');
15
- script.src = partUrl;
16
- script.async = true;
28
+ script.textContent = componentCode;
17
29
  script.type = 'text/javascript';
18
30
  document.body.appendChild(script);
19
-
20
- console.log(`Appended ${componentParts.components[key]} component (${partUrl})`);
21
- });
31
+ });
22
32
  }
23
33
 
24
34
  function defineAllComponents() {