hot
Interfaces
BrowserEvent
An event for the browser HMR client. A reload is the only one content sends.
Properties
files?
optional files?: string[];type
type: "reload";BrowserHmrChannel
The part of remix/node-hmr's BrowserHmrChannel this module uses.
Declared structurally rather than imported, because importing the module that declares it would pull a Node-only dependency into every bundle this package reaches. hotContent holds the only import of it, loaded on demand behind its guard.
Properties
url
readonly url: string;Methods
close()
close(): void;Returns
void
onFileEvents()
onFileEvents(handler): () => void;Parameters
handler
(events) => Promise<readonly BrowserEvent[]>
Returns
() => void
updateWatchedFiles()
updateWatchedFiles(delta): void;Parameters
delta
add
readonly string[]
remove
readonly string[]
Returns
void
FileEvent
A file change the supervisor's watcher observed.
Properties
event
event: "add" | "change" | "unlink";filePath
filePath: string;Functions
hotContent()
function hotContent(content): Promise<void>;Reloads the browser when a file behind a collection changes.
Call it once, beside createContent, and leave it in for production: it does nothing unless remix/node-hmr is supervising the process, which is what a dev command does and a production server does not. That is also why the import below is loaded on demand. remix/node-hmr/runtime is Node-only and can only be imported by a supervised child, so a static import would follow this module into a Worker bundle.
Parameters
content
Record<string, unknown>
The object createContent returned.
Returns
Promise<void>