Sha256: 0e0b403da9a41219a7e9ef69b4d9645a8c9096b7231cd8a5bfbdf1e22e65436c
Contents?: true
Size: 787 Bytes
Versions: 15
Compression:
Stored size: 787 Bytes
Contents
import { set } from "@ember/object"; let CONTAINER = {}; let isInitialized = false; let rootPath; export function setRootPath(path) { rootPath = path; } export function getRootPath() { return rootPath; } // exported so that it can be used in tests export function init() { const dataset = document.getElementById("preloaded-data").dataset; CONTAINER = dataset.preloaded ? JSON.parse(dataset.preloaded) : {}; CONTAINER.rootPath = rootPath; isInitialized = true; } export default { get(key) { if (!isInitialized) { init(); } return CONTAINER[key]; }, }; // used in tests export function mutatePreload(key, value) { if (!isInitialized) { init(); } set(CONTAINER, key, value); } export function uninitialize() { isInitialized = false; }
Version data entries
15 entries across 15 versions & 1 rubygems