hot

tape
import hot from "hot";

while (running) {
    hot.poll();          // rebuilt components are swapped in here
    tick();
}
FunctionReturns
hot.poll()true when rebuilt components were swapped in

In a hot run (tape run --hot), hot.poll() looks for a rebuilt program and swaps its components’ new code in, keeping their instances and state. 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 change to a plain function, or to a component’s props) 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: