UNPKG

@deepkit/framework

Version:

32 lines 1.17 kB
/* * Deepkit Framework * Copyright (C) 2021 Deepkit UG, Marc J. Schmidt * * This program is free software: you can redistribute it and/or modify * it under the terms of the MIT License. * * You should have received a copy of the MIT License along with this program. */ import { AsyncLocalStorage } from 'async_hooks'; const __ΩSimpleStore = ['SimpleStore', 'P&"LMw!y']; export { __ΩSimpleStore as __ΩSimpleStore }; export class Zone { static enable() { if (this.asyncLocalStorage) return; this.asyncLocalStorage = (AsyncLocalStorage.Ω = [['"']], new AsyncLocalStorage()); this.asyncLocalStorage.enterWith({}); } static current() { if (Zone.asyncLocalStorage) return Zone.asyncLocalStorage.getStore(); return undefined; } static run(data, cb) { if (!Zone.asyncLocalStorage) return cb(); return Zone.asyncLocalStorage.run(data, cb); } } Zone.__type = ['asyncLocalStorage', 'enable', () => __ΩSimpleStore, 'current', () => __ΩSimpleStore, 'data', '', 'cb', 'run', 'Zone', '!3!8sP"0"sPPn#-J0$sPn%2&P"/\'2("0)s5w*']; //# sourceMappingURL=zone.js.map