client-app/app/lib/preload.js in logster-2.5.1 vs client-app/app/lib/preload.js in logster-2.6.0
- old
+ new
@@ -2,13 +2,12 @@
let isInitialized = false;
// exported so that it can be used in tests
export function init() {
const dataset = document.getElementById("preloaded-data").dataset;
- CONTAINER = Em.$.extend(JSON.parse(dataset.preloaded), {
- rootPath: dataset.rootPath
- });
+ CONTAINER = JSON.parse(dataset.preloaded);
+ CONTAINER.rootPath = dataset.rootPath;
isInitialized = true;
}
export default {
get(key) {
@@ -16,5 +15,17 @@
init();
}
return Em.get(CONTAINER, key);
}
};
+
+// used in tests
+export function mutatePreload(key, value) {
+ if (!isInitialized) {
+ init();
+ }
+ Em.set(CONTAINER, key, value);
+}
+
+export function uninitialize() {
+ isInitialized = false;
+}