UNPKG

@leansdk/leanrc

Version:

LeanRC is a MVC framework for creating graceful applications

44 lines (33 loc) 1.13 kB
module.exports = (Module) -> { STARTUP START_RESQUE Facade StartupCommand } = Module:: class ApplicationFacade extends Facade @inheritProtected() @module Module vpbIsInitialized = @private isInitialized: Boolean, default: no cphInstanceMap = Symbol.for '~instanceMap' @protected initializeController: Function, default: (args...)-> @super args... @registerCommand STARTUP, StartupCommand # ... здесь могут быть регистрации и других команд @public startup: Function, default: (aoApplication)-> unless @[vpbIsInitialized] @[vpbIsInitialized] = yes @sendNotification STARTUP, aoApplication unless aoApplication.isLightweight @sendNotification START_RESQUE return @public @static getInstance: Function, default: (asKey)-> vhInstanceMap = Facade[cphInstanceMap] unless vhInstanceMap[asKey]? vhInstanceMap[asKey] = ApplicationFacade.new asKey vhInstanceMap[asKey] ApplicationFacade.initialize()