sw-shared-functions
v0.0.1
Published
Shared functions between client and service worker
Downloads
3
Readme
sw-shared-functions
Shared functions between client and service worker
Installation
npm i sw-shared-functions
Usage
To share
import { share } from 'sw-shared-functions';
export class HelloService {
sayHello(name: string): string {
return `Hello, ${name}`;
}
}
share(new HelloService());
To load
import { load } from 'sw-shared-functions';
import type { HelloService } from '../services/hello.service';
const helloServ = await load<HelloService>();
console.log(await helloServ.sayHello('World!'));
License
MIT. Copyright (c) Kyaw Swar Thwin <[email protected]>