MCPcopy Create free account
hub / github.com/ampproject/amphtml / addToQueue

Function addToQueue

ads/vendors/zen.js:25–50  ·  view source on GitHub ↗

* @param {!Window} global * @param {!Object} data

(global, data)

Source from the content-addressed store, hash-verified

23 * @param {!Object} data
24 */
25function addToQueue(global, data) {
26 global[n] = global[n] || [];
27 global[n].push(() => {
28 // Create container
29 createContainer(global, renderTo);
30
31 const {YandexZen} = global;
32 const config = Object.assign(data, {
33 clid: JSON.parse(data.clid),
34 container: `#${renderTo}`,
35 isAMP: true,
36 successCallback: () => {
37 if (typeof data.successCallback === 'function') {
38 data.successCallback();
39 }
40 },
41 failCallback: () => {
42 if (typeof data.failCallback === 'function') {
43 data.failCallback();
44 }
45 },
46 });
47
48 YandexZen.renderWidget(config);
49 });
50}
51
52/**
53 * @param {!Window} global

Callers 1

zenFunction · 0.70

Calls 4

assignMethod · 0.80
createContainerFunction · 0.70
pushMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected