- Download the
rbxmmodel file attached to the latest release from the GitHub releases page. - Insert the model into Studio into a place like
ReplicatedStorage
- Copy the
srcdirectory into your codebase - Rename the folder to
Rodux - Use a plugin like Rojo to sync the files into a place
Rodux works just like Redux's base API.
See the official Rodux Documentation for more details.
local Rodux = require(script.Parent.Rodux)
local function reducer(state, action)
state = state or {
frobulations = 0,
}
if action.type == "frobulate" then
return {
frobulations = state.frobulations + 1,
}
end
return state
end
local store = Rodux.Store.new(reducer)
store:getState() -- { frobulations = 0 }
store:dispatch({
type = "frobulate",
})
store:getState() -- { frobulations = 1 }Contributions are welcome! See CONTRIBUTING.md for information.
Rodux is available under the Apache 2.0 license. See LICENSE for details.
Store:bindToValueChanged
Binds the given callback function to the store changed event, but only runs when the specified value has changed. Returns a handle to be used in Store:unbindFromValueChanged(handle) to unbind this callback.
Store:bindToValueChanged(callback, ...)
Parameters
- callback [function]: The function you want to run when then specified value changes.
- ... [tuple]: The dictionary path of the value you want to listen for changes to (e.g. (callback, "liveOps", "worlds", "world1") will listen for when the world1 table changes in live ops).
Store:unbindFromValueChanged
Unbinds the given handle which is returned from Store:bindToValueChanged().
Store:unbindFromValueChanged(handle)
Parameters
- handle [function]: The handle to be unbinded.
Store:waitForValue
Unbinds the given handle which is returned from Store:bindToValueChanged().
Store:waitForValue(...)
Parameters
- ... [tuple]: The dictionary path for the value you want to wait for. Will yield until this value exists, and will return the value (e.g. :waitForValue("liveOps") will yield until the live ops table has been added to Rodux)