Comparing version 2.0.0 to 2.1.0
@@ -1,5 +0,1 @@ | ||
function check() { | ||
return Promise.resolve(!navigator.onLine); | ||
} | ||
function listen(evts, func, toAdd) { | ||
@@ -12,2 +8,6 @@ var fn = window[(toAdd ? 'add' : 'remove') + 'EventListener']; | ||
function check() { | ||
return Promise.resolve(!navigator.onLine); | ||
} | ||
function watch(cb) { | ||
@@ -22,3 +22,2 @@ var fn = function (_) { return check().then(cb); }; | ||
export { watch }; | ||
export default check; | ||
export { check, watch }; |
@@ -5,6 +5,2 @@ 'use strict'; | ||
function check() { | ||
return Promise.resolve(!navigator.onLine); | ||
} | ||
function listen(evts, func, toAdd) { | ||
@@ -17,2 +13,6 @@ var fn = window[(toAdd ? 'add' : 'remove') + 'EventListener']; | ||
function check() { | ||
return Promise.resolve(!navigator.onLine); | ||
} | ||
function watch(cb) { | ||
@@ -27,3 +27,3 @@ var fn = function (_) { return check().then(cb); }; | ||
exports.check = check; | ||
exports.watch = watch; | ||
exports['default'] = check; |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e["is-offline"]={})}(this,function(e){"use strict";function n(){return Promise.resolve(!navigator.onLine)}e.watch=function(e){var t=function(e,n,t){var o=window[(t?"add":"remove")+"EventListener"];e.split(" ").forEach(function(e){o(e,n)})}.bind(null,"online offline",function(t){return n().then(e)});return t(!0),function(e){t(!1)}},e.default=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e["is-offline"]={})}(this,function(e){"use strict";function n(){return Promise.resolve(!navigator.onLine)}e.check=n,e.watch=function(e){var t=function(e,n,t){var o=window[(t?"add":"remove")+"EventListener"];e.split(" ").forEach(function(e){o(e,n)})}.bind(null,"online offline",function(t){return n().then(e)});return t(!0),function(e){t(!1)}},Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "is-offline", | ||
"version": "2.0.0", | ||
"description": "A tiny (279B) library to detect `offline` status & respond to changes in the browser.", | ||
"version": "2.1.0", | ||
"description": "A tiny (276B) library to detect `offline` status & respond to changes in the browser.", | ||
"repository": "lukeed/is-offline", | ||
@@ -6,0 +6,0 @@ "umd:main": "dist/is-offline.min.js", |
# is-offline [![Build Status](https://travis-ci.org/lukeed/is-offline.svg?branch=master)](https://travis-ci.org/lukeed/is-offline) | ||
> A tiny (279B) library to detect `offline` status & respond to changes in the browser. | ||
> A tiny (276B) library to detect `offline` status & respond to changes in the browser. | ||
@@ -24,3 +24,3 @@ This module exposes three module definitions: | ||
```js | ||
import isOffline from 'is-offline'; | ||
import { check, watch } from 'is-offline'; | ||
@@ -30,6 +30,6 @@ let foobar = bool => console.log('Am I offline?', bool); | ||
// Check if currently offline | ||
isOffline().then(foobar); | ||
check().then(foobar); | ||
// Setup a "watcher" to respond to all online/offline changes | ||
let unwatch = isOffline.watch(foobar); | ||
let unwatch = watch(foobar); | ||
@@ -36,0 +36,0 @@ // The "watcher" will be active until it's deactivated |
4963
39