react-offline-cache

0.0.6 • Public • Published

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

Natan Cabral
natancabral@hotmail.com
https://github.com/natancabral/

Thank you

Package Sidebar

Install

npm i react-offline-cache

Weekly Downloads

2

Version

0.0.6

License

MIT

Unpacked Size

8.93 kB

Total Files

4

Last publish

Collaborators

  • natancabral