3 ms·
I think the simplest one I ever did was basically a reimplementation of setTimeout in Javascript. It was really only intended as a demonstration, because of cou
by db48x 4y ago
I think the simplest one I ever did was basically a reimplementation of setTimeout in Javascript. It was really only intended as a demonstration, because of course setTimeout is right there, but with only a very slight extension you can save the time you’re supposed to activate to permanent storage so that you can set long timeouts (hours or days) and they still fire correctly if the user leaves the page and returns later. And the code is clear and obviously correct, and now the reader has some idea of how to use the code to create more interesting state machines.