Adds a listener to be invoked when events of the specified type are emitted. An optional calling context may be provided. The data arguments emitted will be passed to the listener function.
Name of the event to listen to
Function to invoke when the specified event is emitted
Rest
...args: any[]Optional
context: anyOptional context object to use when invoking the listener
Emits an event of the given type with the given data. All handlers of that particular type will be notified.
Name of the event to emit
Rest
...params: any[]emitter.addListener('someEvent', function(message) {
console.log(message);
});
emitter.emit('someEvent', 'abc'); // logs 'abc'
DocumentSelectionState is responsible for maintaining selection information for a document.
It is intended for use by AbstractTextEditor-based components for identifying the appropriate start/end positions to modify the DocumentContent, and for programmatically setting browser selection when components re-render.