Store
Deep reactive stores: Flux.store(table) returns a proxy whose fields are tracked per key, with Flux.Store helpers for arrays, snapshots and teardown.
local state = Flux.store({ player = { hp = 100 } })
Flux.effect(function() print(state.player.hp) end)
state.player.hp = 90Functions
new
Store.new<T>(initialState: T): TWraps a plain table in a deep reactive proxy that tracks each read key, nested table, and array length independently. Values that already have a metatable (such as Flux nodes or class instances) are left untouched.
Destroy
Store.Destroy<T>(proxy: T)Tears down a store and all of its nested proxies, disposing their per-key nodes via Flux.dispose while leaving the raw backing table intact.
unwrap
Store.unwrap<T>(proxy: T): TReturns the raw, unproxied backing table of a store for untracked reads or serialization.
insert
Store.insert(proxy: any, posOrValue: any, value: any?)Inserts value into a store array (appending with 2 arguments, or inserting at posOrValue with 3) and notifies length and index observers.
remove
Store.remove(proxy: any, pos: number?): anyRemoves and returns the element at pos (defaulting to the last element) from a store array and notifies length and index observers.
move
Store.move(proxy: any, from: number, to: number)Moves the element at 1-based index from to to in a single tracked step without tearing down nested item proxies.
reconcile
Store.reconcile<T>(proxy: T, newData: T, key: string?): TDiffs newData into the store proxy in place, firing only changed leaf nodes and reusing unchanged nested proxies. Pass key to match array elements by element[key] instead of array index.