web application - mindsers/yabf GitHub Wiki
class WebApplication extends AbstractApplication {
constructor(injectorService: InjectorService, routerService: RouterService, loggerService: LoggerService)
static createInstance(): WebApplication
provide<C>(className: InjectionType<C>): void
provide<C>(className: InjectionClass<C>, dependencies?: InjectionSelector<any>[]): void
declare<C extends Controller>(className: InjectionClass<C>, dependencies: InjectionSelector<any>[] = [])
start(): void
}
The WebApplication
class extends AbstractApplication
class.
An implementation of Application
designed for the web. Add support for Controller
s, routing...
Initialize WebApplication
instance.
constructor(injectorService: InjectorService, routerService: RouterService, loggerService: LoggerService)
-
injectorService
: the service that have the responsibility to create and inject objects. -
routerService
: the service that have the responsibility to resolve routes and call right controllers. -
loggerService
: the service that have the responsibility to write debug logs depending on configuration.
Register a class C
in the application to be used (created and injected) later.
provide<C>(className: InjectionType<C>): void
provide<C>(className: InjectionClass<C>, dependencies?: InjectionSelector<any>[]): void
-
className
: the class that will be registred. Typically a constructor (Class
) or a configuration object ({ identity: Class, useClass: Class }
). -
dependencies
: An array of constructor that wil be injected in the future instance.
void
: This method returns nothing.
Register a controller inside of the application. Work as provide method but registered classes are not in singleton pattern.
declare<C extends Controller>(className: InjectionClass<C>, dependencies: InjectionSelector<any>[] = [])
-
className
: the class that will be registred. Typically a constructor (Class
) or a configuration object ({ identity: Class, useClass: Class }
). -
dependencies
: An array of constructor that wil be injected in the future instance.
void
: This method returns nothing.
Launch the application. This method acts like a classical main
function.
No parameters.
void
: This method returns nothing.
Static factory method which is responsible to create a new instance of WebApplication
if no one is found in the dependency injector scope. If an instance already exists, it will be returned.
static createInstance(): WebApplication
No parameters.
WebApplication
: New or existing instance of WebApplication
.