This package has been deprecated
Author message:
Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
visibility-change-ponyfill
2.0.3 • Public • Published visibility-change-ponyfill
A more reliable visibilitychange event that works in more mobile WebViews
Install
npm install --save visibility-change-ponyfill
import onVisibilityChange from 'visibility-change-ponyfill';
If you don't use node/babel, include this:
<script src="dist/visibility-change-ponyfill.browser.js"></script>
Usage
To add a listener:
onVisibilityChange(function () {
if(document.hidden) {
} else {
}
});
To remove a listener:
function yourOnChangeListener() { };
onVisibilityChange(yourOnChangeListener);
onVisibilityChange.remove(yourOnChangeListener);
To remove all listeners:
onVisibilityChange.removeAll();
License
MIT © Federico Brigante
Dependencies (0)
Dev Dependencies (4)
Package Sidebar
Install
npm i visibility-change-ponyfill
Weekly Downloads