mirror of
https://github.com/littensy/charm.git
synced 2026-10-22 12:41:37 +00:00
feat: add reactive()
This commit is contained in:
parent
7bad215560
commit
bd23d54374
26 changed files with 1129 additions and 569 deletions
|
|
@ -1,11 +1,13 @@
|
|||
local Charm = require("./Charm")
|
||||
local Vide = require("./Vide")
|
||||
|
||||
--- Returns a reactive source that subscribes to the current value of the given
|
||||
--- signal or getter function.
|
||||
---
|
||||
--- @param getter The getter function to subscribe to.
|
||||
--- @return The reactive source.
|
||||
--[[
|
||||
Returns a reactive source that subscribes to the current value of the given
|
||||
signal or getter function.
|
||||
|
||||
@param getter The getter function to subscribe to.
|
||||
@return The reactive source.
|
||||
]]
|
||||
local function useSignalState<State>(getter: () -> State): () -> State
|
||||
local state = Vide.source(getter())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue