◁ Resource Bundle ≡ Table of Contents API Extension ▷
Seanox aspect-js provides events for extensions and for notifying the application about runtime environment states.
The following events occur during rendering. The current selector is passed to the callback method. The method can influence the selector and the corresponding element, but not the rendering.
Composite.listen(Composite.EVENT_RENDER_***, function(event, selector) {
...
});
The event occurs when rendering starts. Processing starts after the event.
The event occurs during recursive rendering iteration when another element starts rendering during a render cycle. Processing starts after the event.
The event occurs after rendering has ended. Processing ends before the event.
The following events occur during View-Module Binding (binding). The current selector is passed to the callback method. The method can influence the selector and the corresponding element, but not the binding.
Composite.listen(Composite.EVENT_MOUNT_***, function(event, selector) {
...
});
The event occurs when binding starts. Processing starts after the event.
The event occurs during recursive binding iteration when another element starts binding during a render cycle. Processing starts after the event.
The event occurs after binding has ended. Processing ends before the event.
The following events occur during the use of application modules (modules).
Occurs when a module is initially loaded. If a module is loaded and unloaded multiple times at runtime, this event will occur only once. The callback method is passed the trigger and the determined module. Triggers can be HTML elements, if modules are addressed via markup, or they can be strings, if modules are addressed programmatically in JavaScript.
Composite.listen(Composite.EVENT_MODULE_***, function(event, context, module) {
...
});
Occurs after the markup of a module is added to the DOM and the dock method is executed. The callback method is passed the event and a meta-object with information about the module.
Composite.listen(Composite.EVENT_MODULE_DOCK, function(event, meta) {
...
});
TODO:
Occurs after the markup of a module is removed from the DOM and the undock method is executed. The callback method is passed the event and a meta-object with information about the module.
Composite.listen(Composite.EVENT_MODULE_UNDOCK, function(event, context, module) {
...
});
The Composite API supports application-wide event management for HTTP requests. This can implement request-related application logic, e.g. for logging or spinners.
The events are described independently of the request API. Currently, only requests via XMLHttpRequest are captured. For each event, the corresponding XMLHttpRequest event is named as a reference.
The callback method is passed the event of the underlying request, not the
request object itself. With XMLHttpRequest, this is a ProgressEvent whose
property target contains the corresponding XMLHttpRequest.
Composite.listen(Composite.EVENT_HTTP_***, function(event, payload) {
...
});
The events are also triggered by the requests with which the application runtime
(runtime) loads the outsourced resources of the composites. These requests are
synchronous. Synchronous requests do not dispatch the events loadstart and
progress, and the states 2 and 3 are skipped. Therefore
Composite.EVENT_HTTP_START and Composite.EVENT_HTTP_PROGRESS do not occur
for them. A spinner is of no use here anyway, because the browser cannot repaint
during a synchronous request.
Triggered when a request to load data is started.
XMLHttpRequest: loadstart
Triggered periodically when a request receives further data.
XMLHttpRequest: progress
Triggered when the status of the request/response changes.
XMLHttpRequest: readystatechange
Triggered when a resource is loaded. The event is also triggered for HTTP status
codes that indicate an error, because the transfer itself was successful.
XMLHttpRequest: load
Triggered when the loading of a resource is aborted.
XMLHttpRequest: abort
Triggered when the loading of a resource is aborted because the maximum loading
time has been exceeded.
XMLHttpRequest: timeout
Triggered when the request fails, e.g. due to a network error. HTTP status codes
that indicate an error do not trigger this event.
XMLHttpRequest: error
Triggered when the request is completed, regardless of any errors or successful
completion.
XMLHttpRequest: loadend
The Composite API supports application-wide event management for runtime errors to implement event-related application logic, for example, for logging or error output.
Composite.listen(Composite.EVENT_ERROR, function(event, Error) {
...
});
The error event is triggered for unhandled runtime errors. Syntax errors that prevent JavaScript from being executed generally cannot trigger the error event.