MCPcopy Index your code
hub / github.com/ampproject/amphtml / select

Method select

src/core/dom/srcset.js:155–165  ·  view source on GitHub ↗

* Performs selection for specified width and DPR. Here, width is the width * in screen pixels and DPR is the device-pixel-ratio or pixel density of * the device. Depending on the circumstances, such as low network conditions, * it's possible to manipulate the result of this method by passin

(width, dpr)

Source from the content-addressed store, hash-verified

153 * @return {string}
154 */
155 select(width, dpr) {
156 devAssert(width, 'width=%s', width);
157 devAssert(dpr, 'dpr=%s', dpr);
158 let index = 0;
159 if (this.widthBased_) {
160 index = this.selectByWidth_(width * dpr);
161 } else {
162 index = this.selectByDpr_(dpr);
163 }
164 return this.sources_[index].url;
165 }
166
167 /**
168 * @param {number} width

Callers 15

inquireForWebpage_Function · 0.80
inquireForTestFunction_Function · 0.80
test-srcset.jsFile · 0.80
updateSrc_Method · 0.80
updateSrc_Method · 0.80
WFunction · 0.80
JFunction · 0.80
d3.jsFile · 0.80
eFunction · 0.80
oFunction · 0.80
sFunction · 0.80
tFunction · 0.80

Calls 3

selectByWidth_Method · 0.95
selectByDpr_Method · 0.95
devAssertFunction · 0.90

Tested by

no test coverage detected