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

yields/visibility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Sane page visibility API.

Resources

Stars

Watchers

Forks

Packages

No packages published