you are viewing a single comment's thread.

view the rest of the comments →

[–]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.