use-pwa
v2.2.0
Published
use-pwa is install and update handler for pwa.
Downloads
3,248
Readme
use-pwa
use-pwa is install and update handler for pwa.
Features
- TypeScript support
- SSR support
- Update support
Installation
npm i --save use-pwa
Example
Before Installation
| OS | Browser | appinstalled | canInstallprompt | enabledA2hs | enabledPwa | isPwa | userChoice |
| ------- | ------- | ------------- | ---------------- | ----------- | ---------- | ------- | ----------------- |
| Mac | Chrome | false
| true
| false
| true
| false
| undefined
|
| 〃 | Safari | false
| false
| false
| false
| false
| undefined
|
| 〃 | Firefox | false
| false
| false
| false
| false
| undefined
|
| Android | Chrome | false
(*1) | true
| false
| true
| false
| undefined
(*2) |
| 〃 | Brave | false
(*1) | true
| false
| true
| false
| undefined
(*2) |
| iOS | Safari | false
| false
| true
| false
| false
| undefined
|
| 〃 | Brave | false
| false
| true
| false
| false
| undefined
|
- Changes to
true
only immediately after installation. - Changes to
object
only immediately after installation.
After Installation
| OS | Browser | appinstalled | canInstallprompt | enabledA2hs | enabledPwa | isPwa | userChoice |
| ------- | ----------- | ------------- | ---------------- | ----------- | ---------- | ------------ | ----------- |
| Mac | PWA | false
(*1) | false
(*1) | false
| true
| true
(*2) | undefined
|
| 〃 | Chrome | false
| false
| false
| true
| false
| undefined
|
| Android | PWA(Chrome) | false
| false
| false
| true
| true
| undefined
|
| 〃 | Chrome | false
| false
| false
| true
| false
| undefined
|
| 〃 | PWA(Brave) | false
| false
| false
| true
| true
| undefined
|
| 〃 | Brave | false
| true
| false
| true
| false
| undefined
|
| iOS | PWA | false
| false
| true
| false
| true
| undefined
|
| 〃 | Safari | false
| false
| true
| false
| false
| undefined
|
true
is set only at first startup.false
is set only at first startup.
Usage
Return
| Return | Type | Optional | Remarks | | ----------------- | :------: | :------: | ------------------------------------------------------------------------------------------- | | appinstalled | Boolean | | MDN | | canInstallprompt | Boolean | | MDN | | enabledA2hs | Boolean | | MDN | | enabledPwa | Boolean | | MDN | | isLoading | Boolean | | | | isPwa | Boolean | | MDN | | showInstallPrompt | Function | | MDN | | userChoice | Object | ✓ | MDN |