Simple dependency graph management in JavaScript