Frontier Software

Browser

event-driven-programming

Event

An event can be defined as “a significant change in state”. — Event-driven architecture

Using sprites from Warlock’s Gauntlet

Event Loop

aka message dispatcher, message loop, message pump, or run loop

Recursively calling JavaScript’s requestAnimationFrame seems the standard way to write these:

function eventLoop() {
  ...
  window.requestAnimationFrame(eventLoop);
}

document.addEventListener("DOMContentLoaded", eventLoop);

Event Handlers

Event Listeners

In addition to writing the event handlers, event handlers also need to be bound to events so that the correct function is called when the event takes place. — Wikipedia