class GlobalContext
A singleton class that represents the global application state.
class GlobalContext extends ManagedObject
Description
An instance of this class is available as app during the entire lifecycle of the application. Use that to access all properties and methods of GlobalContext, e.g. app.theme
and app.addActivity(...)
.
Instance Members
- activities readonlyThe current activity context, an instance of ActivityContext.
- services readonlyThe current service context, an instance of ServiceContext.
- rendererThe current application output renderer, an instance of RenderContext.
- viewportAn object containing information about the user’s viewport, e.g. browser window.
- i18nThe current internationalization context, an object that implements I18nProvider.
- themeThe current theme, an instance of UITheme.
- schedulerThe global asynchronous task scheduler, an instance of Scheduler.
- logThe global message log writer instance, an instance of LogWriter.
- clear()Clears the state of the global application context.
- addActivity(activity, activate?)Adds an activity to the global application context.
- addService(service)Adds a service to the global application context.
- navigate(target, mode?)Navigates to the specified path asynchronously.
- goBack()Navigates back to the previous location in the location history stack.
- render(view, place)Renders the provided view using specified placement options.
- showPage(view?)Displays a full-screen page with the specified content view.
- showDialog(view?)Displays a modal dialog with the specified content view.
- showAlertDialogAsync(config, buttonLabel?)Displays an alert dialog with the specified content and a single dismiss button.
- showConfirmDialogAsync(config, confirmLabel?, cancelLabel?)Displays a confirmation dialog with the specified text and buttons.
- showModalMenuAsync(config, ref?)Displays a context/dropdown menu with the provided list of items.
- animateAsync(ref, animation?)Runs an animation on the provided view output element.
- addLogHandler(minLevel, f)Adds a log sink for the current LogWriter instance.
- setErrorHandler(f)Sets a global unhandled error handler.
- hotReload(handle, ActivityClass)Adds a hot-reload handler for the provided module handle, to update instances of a particular activity.
Inherited Members
- emit(event)Emits an event, immediately calling all event handlers.
- emitChange(name?, data?)Emits a change event, an instance of ManagedChangeEvent.
- listen(handler)Adds a handler for all events emitted by this object.
- isUnlinked()Returns true if the object has been unlinked.
- unlink()Unlinks this managed object.
- beforeUnlink() protectedA method that’s called immediately before unlinking an object, can be overridden.
- attach(target, observer?) protectedAttaches the provided managed object to this object.
- autoAttach(propertyName, observer?) protectedObserves a property, so that any object assigned to it is attached immediately.