Skip to main content

Settings

Settings Singleton Class to allow store server, application and plugins settings during design mode. Can be used on run stage except by the port setting or any other in-design properties everything can be changed and reflected immediately, the fact that some properties will be ignored after design stage is because is used only one time to provide initial settings or some initialization parameters.

Constructor
Settings() #

Constructor is returning a Singleton instance of the class, is that instance is not exists this will create it automatically which it will maintain that reference itself through all the runtime cycle, or you explicit reset it.

Parameters
NameOptionalTypeDefaultsDescription
optionsYesExpressiveTeaServerProps{ port: 3000}Add configurations to the Settings instance used in the application

Properties#

privateStatic
instance #

Singleton Instance Reference.

private
options #

Server configuration options storage.

Methods#

publicStatic
reset()
void
#

Reset Singleton instance to the default values, all changes will be erased is not recommendable to use it multiple times since all your options will be lost, also, unless you have an option how to recover this We STRONGLY not recommended to use often.

Consider this is not DELETE initialization options, even if you deleted this is used one time at the application starts.

publicStatic
getInstance()
ExpressJS
#

Get Current Singleton Instance or Created if not exists, When a new instance is created it will contain default options.

public
getOptions() #

It will return the latest snapshot options registered at the time that this method is called, as Expressive Tea is designed as async methods some time options should not be available.

public
get()
Any
#

Retrieve the option as is designated on \<settingName> parameter, if does not exist it will return null instead of undefined to give them a value and data consistency.

Parameters
NameOptionalTypeDefaultsDescription
settingNameNoStringAdd configurations to the Settings instance used in the application

public
set(
settingName
:String
value
:Any
)
void
#

Initialize or Edit an application options, this is only for in run options, as explained above initialization options it won't affect any functionality as the application already started.

Parameters
NameOptionalTypeDefaultsDescription
settingNameNoStringAdd configurations to the Settings instance used in the application
valueNoAnyAdd configurations to the Settings instance used in the application

public
merge()
void
#

This merges multiple options at the same time, this can edit or create the options.

Parameters
NameOptionalTypeDefaultsDescription
optionsYesExpressiveTeaServerProps{ port: 3000}Add configurations to the Settings instance used in the application