Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Latest commit

 

History

History
53 lines (34 loc) · 699 Bytes

Readme.md

File metadata and controls

53 lines (34 loc) · 699 Bytes

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