Skip to content

Commit

Permalink
feat: add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fwouts committed Jun 17, 2021
1 parent f954f6a commit 112b7af
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,13 @@ For now, calling `import.meta.hot.invalidate()` simply reloads the page.
## `hot.on(event, cb)`
Listen to a custom HMR event. Custom HMR events can be sent from plugins. See [handleHotUpdate](./api-plugin#handlehotupdate) for more details.
Listen to an HMR event.
The following HMR events are dispatched by Vite automatically:
- `'vite:update'` when an update is received (e.g. a module is replaced)
- `'vite:full-reload'` when a full reload is about to occur
- `'vite:prune'` when modules that are no longer needed are pruned
- `'vite:error'` when an error occurs (e.g. syntax error)
Custom HMR events can also be sent from plugins. See [handleHotUpdate](./api-plugin#handlehotupdate) for more details.

0 comments on commit 112b7af

Please sign in to comment.