visibility
Sane page visibility API
Installation
$ component install yields/visibility
API
visibility([fn])
visibility(function (e, state) {
if ('visible' == state) dostuff();
});
visible(fn)
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) {});
prerender(fn)
Execute the given fn
on prerender.
visibility()
.prerender(function () {});
todo
- add tests.
- test in all browsers, currently tested only in Chrome.
License
MIT