import { AsyncLocalStorage } from 'async_hooks' ; export type SimpleStore = { [ name ] : any ; } ; export class Zone { static asyncLocalStorage ? : AsyncLocalStorage < any > ; static enable ( ) { if ( this . asyncLocalStorage ) return ; this . asyncLocalStorage = new AsyncLocalStorage < any > ( ) ; this . asyncLocalStorage . enterWith ( { } ) ; } static current ( ) { if ( Zone . asyncLocalStorage ) return Zone . asyncLocalStorage . getStore ( ) ; return undefined ; } static run < T > ( data , cb ) { if ( ! Zone . asyncLocalStorage ) return cb ( ) ; return Zone . asyncLocalStorage . run ( data , cb ) ; } }