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

Function waitForOpacity

test/integration/test-position-observer.js:175–185  ·  view source on GitHub ↗
(win, comparison, factor)

Source from the content-addressed store, hash-verified

173}
174
175function waitForOpacity(win, comparison, factor) {
176 return poll('wait for opacity to ' + comparison + ': ' + factor, () => {
177 if (comparison == 'equals') {
178 return getOpacity(win) == factor;
179 }
180
181 if (comparison == 'greater-than') {
182 return getOpacity(win) > factor;
183 }
184 });
185}
186
187function ensureOpacityIsNoChangingAnymore(win) {
188 return new Promise((resolve, reject) => {

Callers 1

Calls 2

pollFunction · 0.90
getOpacityFunction · 0.70

Tested by

no test coverage detected