Table of Contents
The Recite Control Panel is an event-driven system. In other words, widgets will respond to certain things happening.
Let's use the File Import widget as an example:
User selects a file to upload then begins the upload. Trigger an event that an "Uploading" status message should be shown.
File continues to upload. Listen for an event that indicates how much has been uploaded and update the display accordingly.
File completes uploading. Trigger an event that the "Uploading" status message should no longer be shown.
Receive confirmation from server that file is uploaded. "File Browser" widget listens for this event. Refreshes its display so the newly uploaded file is displayed.
You can trigger your own events and listen for events accordingly.
Events are named in the format eventName.nameSpace. The namespace is determined by what triggers the event. Events triggered by modules are named module_moduleName.
Let's return to the previous file upload example to demonstrate this. When a file is
uploaded, the server sends back the following event: