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

Method callFunction

extensions/amp-script/0.1/amp-script.js:233–245  ·  view source on GitHub ↗

* Calls the specified function on this amp-script's worker-dom instance. * Accepts variable number of args to pass along to the underlying worker. * * @param {string} unusedFnId - function identifier * @param {...*} unusedFnArgs * @return {!Promise<*>}

(unusedFnId, unusedFnArgs)

Source from the content-addressed store, hash-verified

231 * @return {!Promise<*>}
232 */
233 callFunction(unusedFnId, unusedFnArgs) {
234 return this.initialize_.promise.then(() => {
235 if (!this.workerDom_) {
236 return Promise.reject(
237 new Error(
238 'Attempted to call a function on an amp-script which failed initialization.'
239 )
240 );
241 }
242
243 return this.workerDom_.callFunction.apply(this.workerDom_, arguments);
244 });
245 }
246
247 /** @override */
248 layoutCallback() {

Callers 2

test-amp-script.jsFile · 0.80
test-amp-script.jsFile · 0.80

Calls 2

applyMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected