@zenflux/core 0.0.0-alpha.8 → 0.0.0-alpha.9

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.
@@ -2,6 +2,7 @@ import { IAPIConfig } from "./interfaces/config";
2
2
  import * as exported from './exports';
3
3
  declare global {
4
4
  var ZenCore: any;
5
+ var __ZEN_CORE__IS_INITIALIZED__: boolean;
5
6
  }
6
7
  export declare let config: IAPIConfig;
7
8
  export declare const CoreAPI: {
@@ -1 +1 @@
1
- {"version":3,"file":"initializer.d.ts","sourceRoot":"","sources":["src/initializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC,OAAO,CAAC,MAAM,CAAC;IACX,IAAI,OAAO,EAAE,GAAG,CAAC;CACpB;AAYD,eAAO,IAAI,MAAM,EAAE,UAElB,CAAA;AAGD,eAAO,MAAM,OAAO;;;;;;;;iCACc,UAAU;;kCAiBT,MAAM,IAAI;;CAO5C,CAAA"}
1
+ {"version":3,"file":"initializer.d.ts","sourceRoot":"","sources":["src/initializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC,OAAO,CAAC,MAAM,CAAC;IACX,IAAI,OAAO,EAAE,GAAG,CAAC;IACjB,IAAI,4BAA4B,EAAE,OAAO,CAAC;CAC7C;AAUD,eAAO,IAAI,MAAM,EAAE,UAElB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;iCACc,UAAU;;kCAiBT,MAAM,IAAI;;CAO5C,CAAC"}
@@ -61,7 +61,7 @@ function _objectSpread2(target) {
61
61
  return target;
62
62
  }
63
63
 
64
- var version = "0.0.0-alpha.8";
64
+ var version = "0.0.0-alpha.9";
65
65
 
66
66
  function _regeneratorRuntime() {
67
67
  _regeneratorRuntime = function _regeneratorRuntime() {
@@ -2077,9 +2077,8 @@ modules: index$5,
2077
2077
  utils: index$6
2078
2078
  });
2079
2079
 
2080
- var isInitialized = false;
2081
2080
  function errorInitTwice() {
2082
- if (isInitialized) {
2081
+ if ('undefined' !== typeof __ZEN_CORE__IS_INITIALIZED__ && __ZEN_CORE__IS_INITIALIZED__) {
2083
2082
  throw new Error('ZenCore is already initialized.');
2084
2083
  }
2085
2084
  }
@@ -2092,11 +2091,11 @@ var CoreAPI = _objectSpread2({
2092
2091
  errorInitTwice();
2093
2092
  config = configuration || config;
2094
2093
  initialize(config);
2095
- isInitialized = true;
2094
+ globalThis.__ZEN_CORE__IS_INITIALIZED__ = true;
2096
2095
  },
2097
2096
  destroy: function destroy$1() {
2098
2097
  destroy();
2099
- isInitialized = false;
2098
+ globalThis.__ZEN_CORE__IS_INITIALIZED__ = false;
2100
2099
  },
2101
2100
  onAfterInitialize: function onAfterInitialize(callback) {
2102
2101
  afterInitializeCallbacks.push(callback);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenflux/core",
3
- "version": "0.0.0-alpha.8",
3
+ "version": "0.0.0-alpha.9",
4
4
  "description": "ZenFlux core",
5
5
  "keywords": [
6
6
  "zenflux",
@@ -41,7 +41,7 @@
41
41
  "@types/jest": "^29.2.5",
42
42
  "@typescript-eslint/eslint-plugin": "^5.48.0",
43
43
  "@typescript-eslint/parser": "^5.48.0",
44
- "@zenflux/rollup-toolkit": "^0.0.0-alpha.13",
44
+ "@zenflux/rollup-toolkit": "^0.0.0-alpha.14",
45
45
  "babel-jest": "^29.3.1",
46
46
  "ts-jest": "^29.0.3",
47
47
  "tslib": "^2.4.1"
@@ -1,5 +1,5 @@
1
1
  // @ts-ignore
2
- import * as pkg from "../package.json" assert {type: "json"};
2
+ import * as pkg from "../package.json" assert { type: "json" };
3
3
 
4
4
  import { IAPIConfig } from "./interfaces/config";
5
5
 
@@ -9,12 +9,11 @@ import * as exported from './exports';
9
9
 
10
10
  declare global {
11
11
  var ZenCore: any;
12
+ var __ZEN_CORE__IS_INITIALIZED__: boolean;
12
13
  }
13
14
 
14
- let isInitialized = false;
15
-
16
15
  function errorInitTwice() {
17
- if ( isInitialized ) {
16
+ if ( 'undefined' !== typeof __ZEN_CORE__IS_INITIALIZED__ && __ZEN_CORE__IS_INITIALIZED__) {
18
17
  throw new Error( 'ZenCore is already initialized.' );
19
18
  }
20
19
  }
@@ -23,8 +22,7 @@ errorInitTwice();
23
22
 
24
23
  export let config: IAPIConfig = {
25
24
  version: pkg.version,
26
- }
27
-
25
+ };
28
26
 
29
27
  export const CoreAPI = {
30
28
  initialize: ( configuration?: IAPIConfig ) => {
@@ -32,16 +30,16 @@ export const CoreAPI = {
32
30
 
33
31
  config = configuration || config;
34
32
 
35
- initialize( config )
33
+ initialize( config );
36
34
 
37
- isInitialized = true;
35
+ globalThis.__ZEN_CORE__IS_INITIALIZED__ = true;
38
36
 
39
37
  },
40
38
 
41
39
  destroy: () => {
42
40
  destroy();
43
41
 
44
- isInitialized = false;
42
+ globalThis.__ZEN_CORE__IS_INITIALIZED__ = false;
45
43
  },
46
44
 
47
45
  onAfterInitialize: ( callback: () => void ) => {
@@ -51,7 +49,7 @@ export const CoreAPI = {
51
49
  config,
52
50
 
53
51
  ...exported,
54
- }
52
+ };
55
53
 
56
54
  // TODO: Make it available only for development.
57
55
  if ( ! globalThis?.ZenCore ) globalThis.ZenCore = CoreAPI;