@sankhyalabs/core 1.0.35 → 1.0.36
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default class ApplicationContext {
|
|
2
|
+
static getContextValue(key) {
|
|
3
|
+
return ApplicationContext.getCtx()[key].deref();
|
|
4
|
+
}
|
|
5
|
+
static setContextValue(key, value) {
|
|
6
|
+
ApplicationContext.getCtx()[key] = new WeakRef(value);
|
|
7
|
+
}
|
|
8
|
+
static getCtx() {
|
|
9
|
+
let ctx = window.___snkcore___ctx___;
|
|
10
|
+
if (!ctx) {
|
|
11
|
+
ctx = {};
|
|
12
|
+
window.___snkcore___ctx___ = ctx;
|
|
13
|
+
}
|
|
14
|
+
return ctx;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ApplicationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationContext.js","sourceRoot":"","sources":["../../src/utils/ApplicationContext.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAE5B,MAAM,CAAC,eAAe,CAAC,GAAW;QACrC,OAAO,kBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACpD,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,GAAW,EAAE,KAAU;QACjD,kBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAEO,MAAM,CAAC,MAAM;QACjB,IAAI,GAAG,GAAI,MAAc,CAAC,mBAAmB,CAAC;QAC9C,IAAG,CAAC,GAAG,EAAC;YACJ,GAAG,GAAG,EAAE,CAAC;YACR,MAAc,CAAC,mBAAmB,GAAG,GAAG,CAAC;SAC7C;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default class ApplicationContext{
|
|
2
|
+
|
|
3
|
+
public static getContextValue(key: string):any{
|
|
4
|
+
return ApplicationContext.getCtx()[key].deref();
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
public static setContextValue(key: string, value: any):any{
|
|
8
|
+
ApplicationContext.getCtx()[key] = new WeakRef(value);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
private static getCtx():any{
|
|
12
|
+
let ctx = (window as any).___snkcore___ctx___;
|
|
13
|
+
if(!ctx){
|
|
14
|
+
ctx = {};
|
|
15
|
+
(window as any).___snkcore___ctx___ = ctx;
|
|
16
|
+
}
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
19
|
+
}
|