mirror of
https://github.com/littensy/charm.git
synced 2026-10-22 21:01:38 +00:00
refactor: code quality
This commit is contained in:
parent
f0a7938703
commit
8ca299f671
16 changed files with 82 additions and 101 deletions
|
|
@ -21,14 +21,7 @@ local function atom<T>(state: T, options: AtomOptions<T>?): Atom<T>
|
|||
|
||||
if state ~= nextState and not (equals and equals(state, nextState)) then
|
||||
state = nextState
|
||||
|
||||
if store.isBatching() then
|
||||
store.batched[atom] = true
|
||||
else
|
||||
for listener in pairs(table.clone(store.listeners[atom])) do
|
||||
listener()
|
||||
end
|
||||
end
|
||||
store.notify(atom)
|
||||
end
|
||||
|
||||
return state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue