import { ShutdownHandler } from './ShutdownHandler' ; /**
 * Bootstrap settings used across all loader.
 * Used to register shutdown handlers - special functions that will be executed when framework is shutdown.
 * Also can be used to store and share data across modules.
 */ export class MicroframeworkSettings { /**
     * Data which can be used to share data across modules.
     */ private data : { [ key ] : any ; } = { } ; /**
     * Special functions that will be executed when framework is shutdown.
     */ private shutdownHandlers : ShutdownHandler [ ] = [ ] ; constructor ( private config ) { } /**
     * Sets data that can be used across other modules.
     */ setData ( key , value ) { this . data [ key ] = value ; return this ; } /**
     * Gets previously set data by this or before executed module.
     */ getData ( key ) { return this . data [ key ] ; } /**
     * Adds a shutdown handler - special function that will be executed when framework is shutdown.
     */ onShutdown ( handler ) { this . shutdownHandlers . push ( handler ) ; return this ; } /**
     * Gets all shutdown handlers - special functions that will be executed when framework is shutdown.
     */ getShutdownHandlers ( ) { return this . shutdownHandlers . map ( handlers => handlers ) ; } }