Sane page visibility API
$ component install yields/visibility
visibility(function (e, state) {
if ('visible' == state) dostuff();
});
Execute the given fn
when the page is visible.
visibility()
.visible(function (e) {});
hidden(fn)
Execute the given fn
when the page is hidden.
visibility()
.hidden(function (e) {});
Execute the given fn
on prerender.
visibility()
.prerender(function () {});
- add tests.
- test in all browsers, currently tested only in Chrome.
MIT