feat: prepare for alpha release

This commit is contained in:
littensy 2025-10-02 01:43:28 -07:00
parent 5a05f01223
commit f5709c3112
10 changed files with 251 additions and 54 deletions

View file

@ -6,7 +6,7 @@ type SyncPayload = types.SyncPayload
local atomRegister: { [string]: Charm.Atom } = {}
local function registerAtoms(atoms: { [string]: Charm.Atom })
local function syncAtoms(atoms: { [string]: Charm.Atom })
for key, atom in atoms do
if atomRegister[key] and atomRegister[key] ~= atom then
warn("[Charm] Attempted to sync different atoms with the same key:", key)
@ -17,17 +17,17 @@ local function registerAtoms(atoms: { [string]: Charm.Atom })
end
end
local function clearAtoms()
table.clear(atomRegister)
end
local function unregisterAtoms(...: string)
local function unsyncAtoms(...: string)
for index = 1, select("#", ...) do
local key = select(index, ...)
atomRegister[key] = nil
end
end
local function reset()
table.clear(atomRegister)
end
local function applyInitPayload(data: { [string]: any })
for key, value in data do
local atom = atomRegister[key]
@ -62,8 +62,8 @@ local function applyPayloads(payloads: { SyncPayload })
end
return {
registerAtoms = registerAtoms,
clearAtoms = clearAtoms,
unregisterAtoms = unregisterAtoms,
syncAtoms = syncAtoms,
unsyncAtoms = unsyncAtoms,
reset = reset,
applyPayloads = applyPayloads,
}