* 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)
| 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 |
no test coverage detected