MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / notify

Method notify

packages/core/data/observable/index.ts:409–422  ·  view source on GitHub ↗

* Notify this Observable instance with some data. This causes all event * handlers on the Observable instance to be called, as well as any 'global' * event handlers set on the instance's class. * * @param data an object that satisfies the EventData interface, though with * an optional 'obj

(data: T)

Source from the content-addressed store, hash-verified

407 * will implicitly be set as this Observable instance.
408 */
409 public notify<T extends Optional<EventData, 'object'>>(data: T): void {
410 data.object = data.object || this;
411 const dataWithObject = data as EventData;
412
413 const eventClass = this.constructor.name;
414 this._globalNotify(eventClass, 'First', dataWithObject);
415
416 const observers = this._observers[data.eventName];
417 if (observers) {
418 Observable._fireEvent(observers, dataWithObject);
419 }
420
421 this._globalNotify(eventClass, '', dataWithObject);
422 }
423
424 private static _fireEvent<T extends EventData>(observers: Array<ListenerEntry>, data: T): void {
425 const length = observers.length;

Callers 3

setPropertyMethod · 0.95
notifyPropertyChangeMethod · 0.95
_emitMethod · 0.95

Calls 2

_globalNotifyMethod · 0.95
_fireEventMethod · 0.80

Tested by

no test coverage detected