hot
import hot from "hot";
while (running) {
hot.poll(); // rebuilt code is swapped in here
tick();
}| Function | Returns |
|---|---|
hot.poll() | true when rebuilt code was swapped in |
In a hot run (tape run --hot), hot.poll()
looks for a rebuilt program and swaps the new code of its components and
functions in, keeping the components’ instances and state. A function
call already running finishes in the old code; every later call runs the
new one. Outside a hot run it does nothing and returns
false, so a program can always call it.
Call it where no component code is running: the main loop, between frames
or events. Called from inside a component’s code it traps. ui.run calls
it between events for you.
A reload that needs a restart (a function’s parameters or result, a
component’s props, a global) is not applied: hot.poll() returns false, the old
code keeps running, and the reason is printed on stderr. What a reload
takes, vars and coroutines included: tape run §Hot reload.
Last modified: