StaticConstruction event is fired whenever the
Application Runtime Environment loads the application.
StaticConstruction event is provided for developers to execute one-time logic which is needed prior to the rest of the scripts in the application being executed.
It is imperative that one use the
ConstructionComplete action once the preparation tasks in the
StaticConstruction script are complete. Applications which define a
StaticConstruction-triggered script have all other scripts initially loaded in a disabled status. Scripts in this disabled state can not receive events. Once
ConstructionComplete has been called by the
StaticConstruction-triggered script, the rest of the scripts in the application are then enabled and are therefore able to receive events and execute.
If one chooses to not define a
StaticConstruction-triggered script within the application, then all the scripts in the application are considered ready to be executed as soon as the application is loaded. All the scripts in such applications are immediately enabled and are able to process events after being loaded.
StaticConstruction event is completely optional.
A common use case for this model is when one intends to monitor the status of a group of users for presence status changes for the lifetime of an application. In such a case, one would want to know when the application is initially loaded, and at that time use
TriggeringSubscribe to establish a subscription on that group as a one-time operation. With the
StaticConstruction event, one has an appropriate location to apply this preparation logic.
StaticConstruction occurs whenever an application is loaded, which occurs whenever the application is first installed while the
application server service is running, or if the application server service is first starting and is loading an already-installed application.
The script initiated by the
StaticConstruction is just like any other script, meaning it has global variables, can invoke asynchronous actions, receive unsolicited events, etc. The only significant difference is that one should be sure to use the
ConstructionComplete action once all the preparation tasks that are required for the execution of the other scripts are complete.
An application should only define one script triggered by the
No Event Parameters