1.0.9 • Published 2 years ago

no-internet-web-craft v1.0.9

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

no-internet-web-craft

If you want to craft the browser default no-internet page according to your design, You can use this libaray. This will library make sure to show your crafted page whenever any document page will not loaded.

Pre-requirements:

  1. Download the sw.js file
  2. Put this file inside your project root directory, the name must be same as sw.js
  3. Create and design a html file which you want to show when internet issue or server unavaialbe. (like no-internet.html)
  4. Put this file inside your project root directory.

How to use

Install the package using npm or script: npm install

NPM

Install using npm:

 npm i no-internet-web-craft

Initialisation in ESM style

import NoInternetWebCraft from 'no-internet-web-craft';

const wc = new NoInternetWebCraft('/no-internet.html', '1.0.0')
wc.initWebSocket().then((res) => {
    if (res.status === 'success') {
        console.log('Service worker activated')
    } else {
        console.log('Service worker activation failed')
    }
})
UMD

Put this script tag inside your tag:

<script src="https://www.unpkg.com/no-internet-web-craft@1.0.9/umd/no-internet-web-craft.min.js"></script>

Initialisation in UMD style

The NoInternetWebCraft constructor function will available at the global lavel.

const wc = new NoInternetWebCraft('/no-internet.html', '1.0.0')
wc.initWebSocket().then((res) => {
    if (res.status === 'success') {
        console.log('Service worker activated')
    } else {
        console.log('Service worker activation failed')
    }
})

License

MIT

Keywords

rollup typescript Babel promises

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago