mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-07 15:23:07 +00:00
use enum for waku health events
This commit is contained in:
parent
1a976da10f
commit
8eb1fac66f
@ -12,7 +12,7 @@ This is an experimental feature and has a number of [limitations](https://github
|
|||||||
## Import Waku SDK
|
## Import Waku SDK
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npm install @waku/sdk@0.0.35-921b65f.0
|
npm install @waku/sdk@0.0.35-67a7287.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Or using a CDN, note this is an ESM package so `type="module"` is needed.
|
Or using a CDN, note this is an ESM package so `type="module"` is needed.
|
||||||
@ -23,7 +23,7 @@ Or using a CDN, note this is an ESM package so `type="module"` is needed.
|
|||||||
createLightNode,
|
createLightNode,
|
||||||
ReliableChannelEvent,
|
ReliableChannelEvent,
|
||||||
ReliableChannel
|
ReliableChannel
|
||||||
} from 'https://unpkg.com/@waku/sdk@0.0.35-921b65f.0/bundle/index.js';
|
} from 'https://unpkg.com/@waku/sdk@0.0.35-67a7287.0/bundle/index.js';
|
||||||
|
|
||||||
// Your code here
|
// Your code here
|
||||||
|
|
||||||
@ -72,9 +72,9 @@ The Waku node will emit `health` events to help you know whether the node is con
|
|||||||
This can be useful to give feedback to the user, or stop some action (e.g. sending messages) when offline:
|
This can be useful to give feedback to the user, or stop some action (e.g. sending messages) when offline:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { HealthStatus } from "@waku/sdk";
|
import { HealthStatus, WakuEvent } from "@waku/sdk";
|
||||||
|
|
||||||
node.events.addEventListener('waku:health', (event) => {
|
node.events.addEventListener(WakuEvent.Health, (event) => {
|
||||||
const health = event.detail;
|
const health = event.detail;
|
||||||
|
|
||||||
if (health === HealthStatus.SufficientlyHealthy) {
|
if (health === HealthStatus.SufficientlyHealthy) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user