https://github.com/douganderson444/hypns-svelte-component
A Svelte Component importing and bundling HyPNS so it can be used out of the box
https://github.com/douganderson444/hypns-svelte-component
Last synced: 3 months ago
JSON representation
A Svelte Component importing and bundling HyPNS so it can be used out of the box
- Host: GitHub
- URL: https://github.com/douganderson444/hypns-svelte-component
- Owner: DougAnderson444
- License: other
- Created: 2020-10-08T18:42:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-16T11:04:57.000Z (almost 3 years ago)
- Last Synced: 2025-02-25T06:41:26.213Z (3 months ago)
- Language: Svelte
- Size: 6.01 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HyPNS Svelte Component
A Svelte wrapper for [HyPNS](https://github.com/DougAnderson444/HyPNS)
## Install
```js
npm i hypns-svelte-component
```## Rationale
[HyPNS](https://github.com/DougAnderson444/HyPNS) uses [@corestore/networker](https://www.npmjs.com/package/@corestore/networker) which has networking that should be opened and closed intelligently.
Notably, when using HyPNS, you should remember to
```js
await HyPNS.close(); // remembering things sucks, there's a better way! Let's use the computer
```Instead of pushing this obligation out into userland, this handy little Svelte component wraps HyPNS with listeners that activate if:
- The window is [terminated](https://developers.google.com/web/updates/2018/07/page-lifecycle-api#state-terminated) using [`"pagehide"`](https://developers.google.com/web/updates/2018/07/page-lifecycle-api#the-unload-event), or
- The svelte component is destroyed, using [`"onDestroy"`](https://svelte.dev/docs#onDestroy)## Demo
This repo comes with a demo that runs using
```
npm run dev
```The demo shows how to use a keypair, provided by the PeerPiper web wallet, to sign posts to HYPNS.
## Versions
'>= 2.80 Supports HyPNS v2.0'
'< 2.8.0 Supports HyPNS v1.0'