MCPcopy
hub / github.com/ampproject/amphtml / add

Method add

src/core/data-structures/observable.js:22–30  ·  view source on GitHub ↗

* Adds the observer to this instance. * @param {function(TYPE=):void} handler Observer's handler. * @return {import('#core/types/function/types').UnlistenCallback}

(handler)

Source from the content-addressed store, hash-verified

20 * @return {import('#core/types/function/types').UnlistenCallback}
21 */
22 add(handler) {
23 if (!this.handlers_) {
24 this.handlers_ = [];
25 }
26 this.handlers_.push(handler);
27 return () => {
28 this.remove(handler);
29 };
30 }
31
32 /**
33 * Removes the observer from this instance.

Callers 8

wrapFunction · 0.45
applyStaticLayoutFunction · 0.45
applyFillContentFunction · 0.45
processEntriesFunction · 0.45
ioCallbackFunction · 0.45
getInObFunction · 0.45
getInObFunction · 0.45

Calls 2

removeMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected