Documentation / @andrew_l/app / AppDefinition
Interface: AppDefinition<P, S, M, RuntimeContext, EntryContext, SetupContext> ​
Shape of an application — name, typed props, lifecycle hooks, and optional methods.
Extended by ​
Type Parameters ​
P ​
P extends ObjectPropsOptions = { }
S ​
S extends Record<string, any> = { }
M ​
M extends Record<string, AnyFunction> = { }
RuntimeContext ​
RuntimeContext extends RuntimeContext = RuntimeContext<S & M>
EntryContext ​
EntryContext extends EntryContext = EntryContext<S & M>
SetupContext ​
SetupContext extends SetupContext = SetupContext<M>
Properties ​
description? ​
optionaldescription:string
Describe what your application does
filePath? ​
optionalfilePath:null|string
Path to the file where this definition exports default Usually you should not use this option, because it tracks automatically
logger? ​
optionallogger:false|Logger| (definition) =>Logger
Logger instance or constructor function
methods? ​
optionalmethods:M&ThisType<RuntimeContext>
Custom methods which will be available under this context
name ​
name:
string
Name of your awesome application
props? ​
optionalprops:P
Props options to be parsed from cli arguments of env variables
Methods ​
entry()? ​
optionalentry(this,props):any
Entry function that will be called each time when application starts
Parameters ​
this ​
EntryContext
props ​
Returns ​
any
setup()? ​
optionalsetup(this,props):Awaitable<S>
Setup function to initialize application. Will be called once
Parameters ​
this ​
SetupContext
props ​
Returns ​
Awaitable<S>
shutdown()? ​
optionalshutdown(this,props):Awaitable<void>
Shutdown function that will be called before application/process graceful shutdown
Parameters ​
this ​
RuntimeContext
props ​
Returns ​
Awaitable<void>
stop()? ​
optionalstop(this,props):Awaitable<void>
Stop function that will be called each time when application stops
Parameters ​
this ​
RuntimeContext
props ​
Returns ​
Awaitable<void>