Scan your whole stack
From OX Research Newsroom
Are you using @rbxts/charm?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.12.0-alpha.0
@rbxts/charm was last scanned on 27 Nov 2026 at version 0.12.0-alpha.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.12.0-alpha.0 LATEST | 27 Nov 2026 | No rules fired |
| 0.11.1 | 1 Oct 2026 | No rules fired |
Findings for v0.12.0-alpha.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.12.0-alpha.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Charm is a reactive state management library designed for storing data in discrete containers called signals. Connect behavior to data with signals, ensuring systems stay up-to-date with their underlying data while reactivity eliminates the need for manual updates.
Build game state from simple building blocks:
Want to learn more about reactivity?
Migrating from an older version of Charm?
signal(initialValue, equals?)computed(getter)effect(callback)effectScope(callback)listen(getter, callback)observe(getter, callback)subscribe(getter, callback)untracked(callback)batch(callback)mapped(getter, transform)onCleanup(callback, failSilently?)atom(initialValue, equals?)trigger(callback)flagsreactive(initialValue)toRaw(value)isReactive(value)local getTodos, setTodos = signal({} :: { string })
local getQuery, setQuery = signal("")
observe(getTodos, function(todo: string, index: number)
local instance = Instance.new("TextLabel")
local getText = computed(function()
return getTodos()[index] or ""
end)
effect(function()
instance.Text = getText()
instance.Visible = string.match(getText(), getQuery()) ~= nil
end)
instance.LayoutOrder = index
instance.Size = UDim2.new(1, 0, 0, 40)
instance.Parent = screenGui
return function()
instance:Destroy()
end
end)
setTodos({ "Buy milk", "Buy eggs", "Play Roblox" })
setQuery("Buy")
-- Declare state for a todo list and a search query
local getTodos, setTodos = signal({} :: { string })
local getQuery, setQuery = signal("")
-- Create a text label when an item is added to the list
observe(getTodos, function(todo, index)
local instance = Instance.new("TextLabel")
-- Create a memoized function that only re-runs effects when the todo list
-- updates or the function returns new text
local getText = computed(function()
return getTodos()[index] or ""
end)
-- Update instance properties when the text or query updates
effect(function()
instance.Text = getText()
instance.Visible = string.match(getText(), getQuery()) ~= nil
end)
instance.LayoutOrder = index
instance.Size = UDim2.new(1, 0, 0, 40)
instance.Parent = screenGui
-- Destroy the instance when this item is removed
return function()
instance:Destroy()
end
end)
-- Add items to the todo list
setTodos({ "Buy milk", "Buy eggs", "Play Roblox" })
-- Filter for items containing "Buy"
setQuery("Buy")
npm install @rbxts/charm
yarn add @rbxts/charm
pnpm add @rbxts/charm
# wally.toml
[dependencies]
Charm = "littensy/charm@VERSION"
signal(initialValue, equals?)Signals are the core of reactivity in Charm. The signal function creates a reactive signal that acts as a container for a value. It returns a function to access the value, and another to update the value.
local getCounter, setCounter = signal(0)
setCounter(1)
setCounter(function(count)
return count + 1
end)
print(getCounter()) -- 2
Accessing the signal's value in an effect or computed signal will subscribe to it as a dependency. Changing the value will immediately notify every effect and computed signal that depends on the signal, ensuring all of your state is correct and up-to-date.
You can also pass a custom equality function to only update the signal if the equality function returns false:
local getMax, setMax = signal(0, function(current, incoming)
return incoming <= current
end)
setMax(1) -- 1
setMax(2) -- 2
setMax(-1) -- 2
[!NOTE] Looking for atoms? You can still use
atom()to create a signal with a unified getter and setter.
effect(callback)Effects are fundamental to reactivity, allowing you to react to signal updates. The effect function subscribes to signals accessed by the effect callback, and when a dependency updates, the callback will re-execute.
local getCounter, setCounter = signal(0)
effect(function()
print(`Count is {getCounter()}`)
end) -- Count is 0
setCounter(1) -- Count is 1
You can also return a cleanup function that will run once, either before the effect re-runs or when the effect is disposed:
local getCounter, setCounter = signal(0)
local dispose = effect(function()
local count = getCounter()
return function()
print(`Cleanup {count}`)
end
end)
setCounter(1) -- Cleanup 0
dispose() -- Cleanup 1
An effect is nested if it was created during the execution of another effect. In Charm, when an effect with nested effects re-runs or gets cleaned up, the nested effects from the previous run are automatically cleaned up and re-created if needed. This prevents memory leaks and ensures that outer effects always run before their inner effects:
local getPrintCount, setPrintCount = signal(true)
local getCount, setCount = signal(1)
effect(function()
if getPrintCount() then
-- This inner effect is created when getPrintCount() is true
effect(function()
print(`Count is {getCount()}`)
end)
end
end) -- Count is 1
setCount(2) -- Count is 2
-- This re-runs the outer effect and cleans up old inner effects
setPrintCount(false)
setCount(3) -- No output
[!NOTE] To run code that is "detached" from the parent effect or scope, use
untracked()or a detached effect scope. If you suspect that the new nested effect behavior is causing issues with migration, try disabling theflags.trackInnerEffectsflag to assist with debugging.
computed(getter)The computed function creates a read-only signal whose value is derived from other signals. The computed signal caches the getter function's last result, and the value is only re-computed if a dependency has updated since the last computation.
local getName, setName = signal("John")
local getSurname, setSurname = signal("Doe")
local getFullName = computed(function()
return `{getName()} {getSurname()}`
end)
print(getFullName()) -- "John Doe"
setName("Jane")
print(getFullName()) -- "Jane Doe"
The getter function also receives the previous result (or nil during the initial run). You can use this for computed signals that depend on the previous result:
local getCounter, setCounter = signal(10)
local getMax = computed(function(prevMax)
return math.max(getCounter(), prevMax or 0)
end)
print(getMax()) -- 10
setCounter(5)
print(getMax()) -- 10
effectScope(callback)Scopes allow you to dispose multiple effects at once. The effectScope function creates a scope that tracks inner effects, so effects created during the execution of the callback will clean up when the scope disposes.
local getCounter, setCounter = signal(0)
local dispose = effectScope(function()
effect(function()
print(`Count 1 is {getCounter()}`)
end)
effect(function()
print(`Count 2 is {getCounter()}`)
end)
end)
setCounter(1) -- Count 1 is 1, Count 2 is 1
dispose()
setCounter(2) -- No output; effects got disposed
Similar to effect(), the callback can return a cleanup function that runs when the effect scope is disposed.
listen(getter, callback)The listen function creates an effect that only subscribes to the signals accessed by getter. Signals accessed by the callback will not be subscribed to, avoiding accidental subscriptions when you want to run side effects.
The callback also receives the previous value, or nil when running for the first time.
local getCounter, setCounter = signal(0)
listen(getCounter, function(count, prevCount)
print(`Count is {count} (was {prevCount})`)
end) -- Count is 0 (was nil)
setCounter(1) -- Count is 1 (was 0)
Note that the listener callback runs in untracked(), so nested effects are not cleaned up.
In most Charm APIs, you can also subscribe to getter functions that call one or more signals, and they will automatically be tracked:
local getCounter, setCounter = signal(0)
local function floorCounter()
return math.floor(getCounter())
end
listen(floorCounter, function(count, prevCount)
print(`Floor of count is {count} (was {prevCount})`)
end) -- Floor of count is 0 (was nil)
setCounter(0.5) -- Doesn't print anything, floor is still 0
setCounter(1) -- Floor of count is 1 (was 0)
observe(getter, callback)Observers allow you to track the lifetime of a given state. The observe function executes the callback for every unique key added to a table, and disposes the callback when that key is removed.
local getItems, setItems = signal({ a = 0, b = 0 })
observe(getItems, function(value, key)
print(`Added {key}`)
return function()
print(`Removed {key}`)
end
end) -- Added a, Added b
setItems({ a = 0, c = 0 }) -- Removed b, Added c
The callback runs in an effect scope, so effects created in the callback will be disposed when the key is removed:
local getItems, setItems = signal({})
local dispose = observe(getItems, function(value, key)
local getValue = computed(function(prevValue)
return getItems()[key] or prevValue
end)
effect(function()
local value = getValue()
print(`Set {key} = {value}`)
return function()
print(`Cleanup {key} = {value}`)
end
end)
end)
setItems({ a = 0, b = 0 }) -- Set a = 0, Set b = 0
setItems({ a = 1, b = 0 }) -- Cleanup a = 0, Set a = 1
setItems({ a = 1 }) -- Cleanup b = 0
dispose() -- Cleanup a = 1
subscribe(getter, callback)The subscribe function is identical to listen(), but the callback does not run initially. The callback only runs when the value returned by the getter function changes.
local getCounter, setCounter = signal(0)
-- Does not output anything initially
subscribe(getCounter, function(count, prevCount)
print(`Count is {count} (was {prevCount})`)
end)
setCounter(1) -- Count is 1 (was 0)
untracked(callback)In case you want to opt-out of dependency tracking in an effect, you can use untracked() to call a function outside the current scope, preventing signals and effects in the function from being tracked.
local getTracked, setTracked = signal(0)
local getUntracked, setUntracked = signal(0)
effect(function()
print(`Tracked: {getTracked()}, Untracked: {untracked(getUntracked)}`)
end) -- Tracked: 0, Untracked: 0
setTracked(1) -- Tracked: 1, Untracked: 0
setUntracked(1) -- No output
setTracked(2) -- Tracked: 2, Untracked: 1
Because untracked() executes the callback outside the current effect, nested effects created during the execution of the callback will not be tracked by the parent effect:
local stopEffect
local stopScope = effectScope(function()
untracked(function()
stopEffect = effect(function()
return function()
print("Cleaned up untracked effect")
end
end)
end)
end)
stopScope() -- No output, the scope did not track the effect
stopEffect() -- Cleaned up untracked effect
batch(callback)Combines multiple signal updates made by the callback into a single commit that triggers effects once the callback completes.
local getName, setName = signal("John")
local getSurname, setSurname = signal("Doe")
effect(function()
print(`Full name: {getName()} {getSurname()}`)
end)
-- Combines both writes into a single update.
-- Once the callback completes, outputs "Full name: Foo Bar"
batch(function()
setName("Foo")
setSurname("Bar")
end)
mapped(getter, transform)The mapped function iterates over every key in a table and uses the transform function to assign them to a new key and value. The result is returned as a read-only signal containing the new keys and values. When a key's value changes, or a new key is added to the table, transform is called for that key and its current value.
The first value returned by the transform function is used as the new value:
local getList, setList = signal({ "a", "b", "c" })
local getUppercase = mapped(getList, function(value)
return string.upper(value)
end)
print(getUppercase()) -- { "A", "B", "C" }
If the transform function returns two values, the second value is used as the new key:
local getList, setList = signal({ "a", "b", "c" })
local getSwapped = mapped(getList, function(value, key)
return key, value
end)
print(getSwapped()) -- { a = 1, b = 2, c = 3 }
onCleanup(callback, failSilently?)The onCleanup function binds the callback to the currently running effect or effect scope. Multiple cleanup functions can be bound to the same effect.
Unless failSilently is set to true, this function will emit a warning if there is no active effect or scope.
local dispose = effectScope(function()
onCleanup(function()
print("Cleaned up")
end)
end)
dispose() -- Cleaned up
atom(initialValue, equals?)The atom function creates a new reactive signal and returns a single function that acts as both a getter and setter.
If the atom is called with 0 arguments, the atom returns the current value and subscribes to the signal. Otherwise, when called with 1 or more arguments, the atom will update the signal's value.
local counter = atom(0)
print(counter()) -- 0
counter(1)
counter(function(count)
return count + 1
end)
You can also pass a custom equality function to only update the signal if the new value is not equal to the current value:
local max = atom(0, function(current, incoming)
return incoming <= current
end)
max(1) -- 1
max(-1) -- 1
trigger(callback)The trigger() function allows you to manually trigger updates for downstream dependencies when you've directly mutated a signal's value without using the signal setter:
local array = signal({} :: { number })
local length = computed(function()
return #array()
end)
print(length()) -- 0
-- Direct mutation doesn't automatically trigger updates
table.insert(array(), 1)
print(length()) -- Still 0
-- Manually trigger updates
trigger(array)
print(length()) -- 1
You can also trigger multiple signals at once:
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.