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

Method render

extensions/amp-pinterest/0.1/save-button.js:175–196  ·  view source on GitHub ↗

* Prepare the render data, create the node and add handlers * @return {!Promise}

()

Source from the content-addressed store, hash-verified

173 * @return {!Promise}
174 */
175 render() {
176 this.description = encodeURIComponent(this.description);
177 this.media = encodeURIComponent(this.element.getAttribute('data-media'));
178 this.url = encodeURIComponent(this.element.getAttribute('data-url'));
179
180 const query = [
181 'amp=1',
182 `guid=${Util.guid}`,
183 `url=${this.url}`,
184 `media=${this.media}`,
185 `description=${this.description}`,
186 ].join('&');
187 this.href = `https://www.pinterest.com/pin/create/button/?${query}`;
188
189 let promise;
190 if (this.count === 'above' || this.count === 'beside') {
191 promise = this.fetchCount();
192 } else {
193 promise = Promise.resolve();
194 }
195 return promise.then(this.renderTemplate.bind(this));
196 }
197
198 /**
199 * Determine the height of the contents to allow resizing after first layout.

Callers

nothing calls this directly

Calls 4

fetchCountMethod · 0.95
getAttributeMethod · 0.80
resolveMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected