class GlobalEmitter
An object that’s used for emitting events.
class GlobalEmitter<TEvent extends ManagedEvent> extends ManagedObject
Description
Instances of GlobalEmitter can be used as a way to pass messages between application components. This avoids direct dependencies between components, while reusing the existing infrastructure for events.
In particular, emitters are used for handling errors and log messages (in LogWriter), and debugging bindings (see Binding.debug()). Applications can also use their own instances of GlobalEmitter
to reduce direct dependencies where needed.
Constructor
- constructor()Creates a new managed object.
Instance Members
- listen(handler)Adds a (permanent) event listener.
- emitStrongly typed version of ManagedObject.emit().
- isObserved()Returns true if any listeners or observers have been added to this emitter.
Inherited Members
- emitChange(name?, data?)Emits a change event, an instance of ManagedChangeEvent.
- 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.