UNPKG

@hiddentao/clockwork-engine

Version:

A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering

18 lines (17 loc) 462 B
/** * Node Helpers * * Shared utilities for safe node access across rendering layers. */ /** * Execute callback with node state if it exists * * Helper utility for safe node access with default values. * Returns the callback result if node exists, otherwise returns defaultValue. */ export function withNode(nodes, id, callback, defaultValue) { const state = nodes.get(id); if (!state) return defaultValue; return callback(state); }