All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.store.js Maven / Gradle / Ivy

There is a newer version: 3.14.1
Show newest version
import { initInterceptors } from "./interceptor";
import { reactive } from "./reactivity"

let stores = {}
let isReactive = false

export function store(name, value) {
    if (! isReactive) { stores = reactive(stores); isReactive = true; }

    if (value === undefined) {
        return stores[name]
    }

    stores[name] = value

    if (typeof value === 'object' && value !== null && value.hasOwnProperty('init') && typeof value.init === 'function') {
        stores[name].init()
    }

    initInterceptors(stores[name])
}

export function getStores() { return stores }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy