0.17.0 • Published 16 days ago
@tinijs/pwa v0.17.0
TiniJS PWA
The PWA module for TiniJS apps.
It uses workbox-window under the hood.
Install
To manually install the module: npm i @tinijs/pwa
It is recommended to download the Skeleton for a ready-to-use structured project.
Or, install and setup a complete PWA app via the @tinijs/cli CLI tool:
- Install the CLI:
npm i -g @tinijs/cli
- Add PWA capability:
tini pwa init
For more, please visit: https://tinijs.dev (TODO)
Usage
- Expose an API endpoint-ish in
sw.js
addEventListener('message', event => {
if (event.data.type === 'endpoint-1') {
event.ports[0].postMessage({ data: 'a payload' });
}
});
- Communicate with the Service Worker
import {UseWorkbox, Workbox} from '@tinijs/pwa';
@Page({
name: 'app-page-home',
})
export class AppPageHome extends TiniComponent {
@UseWorkbox() workbox!: Workbox;
onReady() {
this.workbox
.messageSW({type: 'endpoint-1'})
.then(value => {
// do something with the value returned from the SW
});
}
}
API
// TODO
Developement
- Create a home for TiniJS:
mkdir TiniJS && cd TiniJS
- Fork the repo
- Install dependencies:
cd pwa && npm i
- Make changes & preview locally:
npm run build && npm pack
- Push changes & create a PR 👌
License
@tinijs/pwa is released under the MIT license.
0.17.0-alpha.0
16 days ago
0.17.0-alpha.1
16 days ago
0.17.0
16 days ago
0.16.0
3 months ago
0.15.0
4 months ago
0.14.0
4 months ago
0.13.0
4 months ago
0.10.0
7 months ago
0.1.0
9 months ago
0.3.0
8 months ago
0.2.0
8 months ago
0.1.1
9 months ago
0.11.0
6 months ago
0.9.0
8 months ago
0.12.0
5 months ago
0.8.0
8 months ago
0.5.0
8 months ago
0.4.0
8 months ago
0.6.0
8 months ago
0.0.2
1 year ago
0.0.1
1 year ago