0.0.6 • Published 2 years ago

react-offline-cache v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-offline-cache

Create a cache to offline connection

A basic cache for React applications. Offline cache to applications. It also serves as a reference for more advanced caching implementations.

Install

npm install react-offline-cache

src/index.js

import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
// react-offline-cache
import * as roc from 'react-offline-cache';

ReactDOM.render(<App />, document.getElementById("root"));

// init faster
roc.register();

How to remove

roc.unregister();

Is online

console.log('online:', roc.isOnline());

Is offline

if(roc.isOffline()) {
  window.alert('Your internet is offline. Sorry.');
}

License

The MIT License.

Author

Thank you