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

Method registerCallback

3p/iframe-messaging-client.js:105–110  ·  view source on GitHub ↗

* Register callback function for message with type messageType. * @param {string} messageType The type of the message. * @param {function(?JsonObject)} callback The callback function to call * when a message with type messageType is received. * @return {function()}

(messageType, callback)

Source from the content-addressed store, hash-verified

103 * @return {function()}
104 */
105 registerCallback(messageType, callback) {
106 // NOTE : no validation done here. any callback can be register
107 // for any callback, and then if that message is received, this
108 // class *will execute* that callback
109 return this.getOrCreateObservableFor_(messageType).add(callback);
110 }
111
112 /**
113 * Send a postMessage to Host Window, or all parent windows if host window is

Callers 9

getDataMethod · 0.95
makeRequestMethod · 0.95
requestOnceMethod · 0.95
onResizeSuccessMethod · 0.80
onResizeDeniedMethod · 0.80

Calls 2

addMethod · 0.45

Tested by

no test coverage detected