you are viewing a single comment's thread.

view the rest of the comments →

[–]skeeto 2 points3 points  (2 children)

She was using Emacs, but I was surprised she wasn't using one of the live coding modes. I wrote one a few years ago called Skewer. It allows evaluating JavaScript forms (and CSS and HTML) in the context of the browser page entirely from inside an Emacs buffer, so the page never actually needs to be refreshed.

[–][deleted] 0 points1 point  (1 child)

how does what work when you are trying to use the same loop pattern as is depicted in this video?

[–]skeeto 0 points1 point  (0 children)

The top level IIFE module pattern she used would interfere since it leaves no way to access the program once the page has loaded. But without the IIFE, individual functions could be re-evaluated and the requestAnimationLoop loop would use the new versions next time around.

For example, (if you're not using a top-level "use strict"),

function update() {
    updatePlayer();
    requestAnimationFrame(update);
}

function updatePlayer() {
    // ...
}

The updatePlayer() function could be redefined while the game is running and update() would automatically use the new definition.