mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
refactor: remove recursive()
This commit is contained in:
parent
78dbaa476c
commit
d741640d28
2 changed files with 0 additions and 37 deletions
15
packages/charm/src/index.d.ts
vendored
15
packages/charm/src/index.d.ts
vendored
|
|
@ -272,21 +272,6 @@ export function observe<V, K extends Key>(
|
||||||
fn: (value: V, key: K) => Cleanup | void,
|
fn: (value: V, key: K) => Cleanup | void,
|
||||||
): Cleanup;
|
): Cleanup;
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables recursive checks for the current reactive node. Currently, only
|
|
||||||
* computed signals use recursion checks, as effects allow recursion.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* computed(() => {
|
|
||||||
* recursive();
|
|
||||||
* setCount(getCount() + 1);
|
|
||||||
* return getCount();
|
|
||||||
* })
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export function recursive(): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a deep reactive value that tracks properties when they're accessed.
|
* Creates a deep reactive value that tracks properties when they're accessed.
|
||||||
* Returns a proxy object that subscribes to changes on any nested property
|
* Returns a proxy object that subscribes to changes on any nested property
|
||||||
|
|
|
||||||
|
|
@ -876,27 +876,6 @@ local function subscribe<T>(getter: () -> T, fn: (state: T, lastState: T) -> ())
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
Disables recursive checks for the current reactive node. Currently, only
|
|
||||||
computed signals use recursion checks, as effects allow recursion.
|
|
||||||
|
|
||||||
@example
|
|
||||||
```luau
|
|
||||||
computed(function()
|
|
||||||
recursive()
|
|
||||||
setCount(getCount() + 1)
|
|
||||||
return getCount()
|
|
||||||
end)
|
|
||||||
```
|
|
||||||
]]
|
|
||||||
local function recursive()
|
|
||||||
if activeSub then
|
|
||||||
activeSub.flags = bit32.band(activeSub.flags, bit32.bnot(RECURSED_CHECK))
|
|
||||||
else
|
|
||||||
warn(debug.traceback("recursive() can only be called inside a reactive node.", 2))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Calls the callback function for each unique key in the table returned by the
|
Calls the callback function for each unique key in the table returned by the
|
||||||
getter. The callback is called once for each key, and again when a new key
|
getter. The callback is called once for each key, and again when a new key
|
||||||
|
|
@ -1185,7 +1164,6 @@ return {
|
||||||
batch = batch,
|
batch = batch,
|
||||||
subscribe = subscribe,
|
subscribe = subscribe,
|
||||||
listen = listen,
|
listen = listen,
|
||||||
recursive = recursive,
|
|
||||||
observe = observe,
|
observe = observe,
|
||||||
mapped = mapped :: (<KI, VI, KO, VO>(
|
mapped = mapped :: (<KI, VI, KO, VO>(
|
||||||
getter: () -> { [KI]: VI },
|
getter: () -> { [KI]: VI },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue