Class: BaseService

Base Service

The Base Service is available with any of Finsemble's advanced packages.

Creates an instance of the Base Service which all service must inherit. Services are spawned from your service.json file and managed by a helper thread - the Service Manager. Services communicate their status and receive status of other services through the Service Manager. Services have an initial handshake with the Service Manager on load, and then either go online or wait for dependant services to come online. Service initialization is completely asynchronous, which allows all services to load at the same time, as long as their dependencies have been met.

Methods

addEventListener
(listenerType, callback)

Really only for shutdown right now. Simple array that gets looped through on shutdown.

Name Type Description
listenerType any

Any event identifier the service provides to operate with.

callback any

The callback to be invoked after the method completes successfully.

onBaseServiceReady
(func)

Conduct operations when the base service becomes ready.

Name Type Description
func any

Any function of code desired to execute when ready.

onDependenciesReady
()

Invokes a method passed in (or on) the object that inherits from the BaseService. In other words, the service instance will have its initialize function called, unless it's using old code, in which case we will have cached the callback earlier.

setOnline
()

Transmits the serviceOnline message that the rest of the dependency manager objects system are listening for.