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

Function getVisibilityChangeEvent

src/core/document/visibility.js:75–81  ·  view source on GitHub ↗

* @param {Document} doc * @return {?string}

(doc)

Source from the content-addressed store, hash-verified

73 * @return {?string}
74 */
75function getVisibilityChangeEvent(doc) {
76 const hiddenProp = getVendorJsPropertyName(doc, 'hidden', true);
77 const vendorStop = hiddenProp.indexOf('Hidden');
78 return vendorStop != -1
79 ? hiddenProp.substring(0, vendorStop) + 'Visibilitychange'
80 : 'visibilitychange';
81}

Calls 1

getVendorJsPropertyNameFunction · 0.90

Tested by

no test coverage detected