esoftplay-event
Version:
event module on esoftplay framework
25 lines (19 loc) • 678 B
text/typescript
// useLibs
// noPage
import { LibCurl } from "esoftplay/cache/lib/curl/import"
import { LibObject } from "esoftplay/cache/lib/object/import"
import useGlobalState, { useGlobalReturn } from "esoftplay/global"
const config = useGlobalState({}, { persistKey: 'bbo-config', loadOnInit: true, inFastStorage: true })
export function state(): useGlobalReturn<any> {
return config
}
export default config
export function addConfig(name: string, data: any) {
config.set(LibObject.set(config.get(), data)(name))
}
export function curlConfig(url: string) {
new LibCurl(url, null, (res, msg) => {
addConfig(Object.keys(res)[0], res[Object.keys(res)[0]])
}, err => {
})
}