visibilityjs
Advanced tools
Comparing version 1.2.7 to 1.2.8
# Change Log | ||
## 1.2.8 “Pioneer 5, solar wind” | ||
* Fix TypeScript module declaration by @maciejmrozinski. | ||
* Fix headless Chrome support by @runspired. | ||
* Reduce project size. | ||
## 1.2.7 “Discoverer 8, hard” | ||
@@ -4,0 +9,0 @@ * Fix type definitions by @dpoetzsch. |
{ | ||
"name": "visibilityjs", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"homepage": "https://github.com/ai/visibilityjs", | ||
@@ -5,0 +5,0 @@ "authors": ["Andrey A.I. Sitnik <andrey@sitnik.ru>"], |
declare module 'visibilityjs' { | ||
export function every(interval: number, callback: Function); | ||
export function onVisible(callback: Function); | ||
export function afterPrerendering(callback: Function); | ||
export function every(interval: number, callback: Function): number; | ||
export function every(interval: number, hiddenInterval: number, callback: Function): number; | ||
export function onVisible(callback: Function): number|boolean; | ||
export function afterPrerendering(callback: Function): number|boolean; | ||
export function isSupported(): boolean; | ||
export function state(): string; | ||
export function hidden(): boolean; | ||
export function unbind(callback: Function); | ||
export function change(listener: VisiblityChangeListener); | ||
export function stop(listener: VisiblityChangeListener); | ||
type VisiblityChangeListener = (event, state: string) => void; | ||
export function unbind(id: number); | ||
export function change(listener: VisiblityChangeListener): number|boolean; | ||
export function stop(id: number): boolean; | ||
type VisiblityChangeListener = (event: Event, state: string) => void; | ||
} |
;(function (global) { | ||
"use strict"; | ||
var lastId = -1; | ||
@@ -5,0 +3,0 @@ |
@@ -12,6 +12,4 @@ // Add Page Visibility API support to old browsers by focus/blur hack. | ||
;(function (document) { | ||
"use strict"; | ||
if ( document.visibilityState || document.webkitVisibilityState ) { | ||
return; | ||
return; | ||
} | ||
@@ -18,0 +16,0 @@ |
;(function (window) { | ||
"use strict"; | ||
var lastTimer = -1; | ||
@@ -160,5 +158,5 @@ | ||
} else { | ||
install(window.Visibility) | ||
install(window.Visibility || require('./visibility.core')) | ||
} | ||
})(window); |
{ | ||
"name": "visibilityjs", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"description": "Wrapper for the Page Visibility API", | ||
@@ -16,16 +16,10 @@ "keywords": [ | ||
"chai": "4.1.2", | ||
"coffee-script": "^1.12.7", | ||
"fs-extra": "5.0.0", | ||
"mocha": "5.0.1", | ||
"sinon": "4.4.2", | ||
"sinon-chai": "2.14.0", | ||
"size-limit": "^0.15.1", | ||
"uglify-js": "^3.3.12" | ||
"coffeescript": "^2.3.0", | ||
"fs-extra": "6.0.1", | ||
"mocha": "5.2.0", | ||
"sinon": "^5.0.7", | ||
"sinon-chai": "3.0.0", | ||
"size-limit": "^0.18.1", | ||
"uglify-js": "^3.3.26" | ||
}, | ||
"size-limit": [ | ||
{ | ||
"path": "index.js", | ||
"limit": "780 B" | ||
} | ||
], | ||
"scripts": { | ||
@@ -32,0 +26,0 @@ "test": "mocha && size-limit" |
@@ -75,2 +75,7 @@ # Visibility.js [](https://travis-ci.org/ai/visibilityjs) | ||
When the page becomes visible, if the callback has not been called in longer than | ||
the visible interval, it will be called immediately. In the example above, if you | ||
hid the page for 9 minutes, `checkForEmail` will get called once while the page is hidden, | ||
and immediately when it is made visible. | ||
`Visibility.every` returns a timer identifier, much like the `setInterval` | ||
@@ -77,0 +82,0 @@ function. However, it cannot be passed to `clearInterval`, and you should use |
29451
343
384