What it does
inventory.onChange listens for Change on inventory: the function you hand it is called back each time. It takes cb, and answers unsubscribe.
Signature
inventory.onChange(cb) → unsubscribeArguments
cb
Example · generated
function start() { const unsubscribe = inventory.onChange(() => {});}inventory.onChange is called with values of the shape its signature asks for. The code sits in start(), which the engine calls once, when the entity spawns.