@tramvai/core 4.19.2 → 4.19.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.
@@ -48,6 +48,25 @@ class App {
48
48
  }
49
49
  }
50
50
  async initialization(env, type = 'init') {
51
+ if (typeof window !== 'undefined' &&
52
+ !window.__TRAMVAI_HTML_READY__ &&
53
+ window.__TRAMVAI_HTML_READY_PROMISE__) {
54
+ await Promise.race([
55
+ window.__TRAMVAI_HTML_READY_PROMISE__,
56
+ new Promise((resolve) => {
57
+ if (document.readyState === 'complete') {
58
+ resolve();
59
+ }
60
+ else {
61
+ document.addEventListener('readystatechange', () => {
62
+ if (document.readyState === 'complete') {
63
+ resolve();
64
+ }
65
+ });
66
+ }
67
+ }),
68
+ ]);
69
+ }
51
70
  const logger = this.di.get({ token: LOGGER_TOKEN, optional: true });
52
71
  const log = logger === null || logger === void 0 ? void 0 : logger('tramvai-core');
53
72
  const commandLineRunner = this.di.get({ token: COMMAND_LINE_RUNNER_TOKEN, optional: true });
package/lib/createApp.js CHANGED
@@ -52,6 +52,25 @@ class App {
52
52
  }
53
53
  }
54
54
  async initialization(env, type = 'init') {
55
+ if (typeof window !== 'undefined' &&
56
+ !window.__TRAMVAI_HTML_READY__ &&
57
+ window.__TRAMVAI_HTML_READY_PROMISE__) {
58
+ await Promise.race([
59
+ window.__TRAMVAI_HTML_READY_PROMISE__,
60
+ new Promise((resolve) => {
61
+ if (document.readyState === 'complete') {
62
+ resolve();
63
+ }
64
+ else {
65
+ document.addEventListener('readystatechange', () => {
66
+ if (document.readyState === 'complete') {
67
+ resolve();
68
+ }
69
+ });
70
+ }
71
+ }),
72
+ ]);
73
+ }
55
74
  const logger = this.di.get({ token: tokensCommon.LOGGER_TOKEN, optional: true });
56
75
  const log = logger === null || logger === void 0 ? void 0 : logger('tramvai-core');
57
76
  const commandLineRunner = this.di.get({ token: tokensCore.COMMAND_LINE_RUNNER_TOKEN, optional: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/core",
3
- "version": "4.19.2",
3
+ "version": "4.19.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@tinkoff/utils": "^2.1.2",
22
- "@tramvai/tokens-common": "4.19.2",
23
- "@tramvai/tokens-core": "4.19.2",
24
- "@tramvai/types-actions-state-context": "4.19.2",
22
+ "@tramvai/tokens-common": "4.19.4",
23
+ "@tramvai/tokens-core": "4.19.4",
24
+ "@tramvai/types-actions-state-context": "4.19.4",
25
25
  "@tinkoff/dippy": "0.10.7",
26
26
  "node-abort-controller": "^3.0.1",
27
27
  "tslib": "^2.4.0"