Skip to content

Commit

Permalink
docs: add hot.off to api-hmr document
Browse files Browse the repository at this point in the history
  • Loading branch information
vincer2040 committed Oct 9, 2023
1 parent 2351628 commit af03bfd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ interface ViteHotContext {
event: T,
cb: (payload: InferCustomEventPayload<T>) => void,
): void
off<T extends string>(
event: T,
cb: (payload: InferCustomEventPayload<T>) => void,
): void
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
}
```
Expand Down Expand Up @@ -181,6 +185,10 @@ The following HMR events are dispatched by Vite automatically:
Custom HMR events can also be sent from plugins. See [handleHotUpdate](./api-plugin#handlehotupdate) for more details.
## `hot.off(event, cb)`
Remove callback from the event listeners
## `hot.send(event, data)`
Send custom events back to Vite's dev server.
Expand Down

0 comments on commit af03bfd

Please sign in to comment.