mirror of
https://github.com/littensy/charm.git
synced 2026-10-21 03:36:11 +00:00
feat: allow conditional dependencies (#4)
* feat: allow conditional dependencies * docs: remove conditional deps warnings * fix: allow nested captures * docs: add dev flag * fix: `try()` uses pcall if passed `finally()` * docs: interval is optional * docs: update readme * docs: add client/server tags
This commit is contained in:
parent
fbc86d22c6
commit
a90d131fed
14 changed files with 290 additions and 98 deletions
|
|
@ -7,34 +7,23 @@ local atom = require(Package.atom)
|
|||
local computed = require(Package.computed)
|
||||
|
||||
local function parameterGenerator()
|
||||
return atom({ count = 0 })
|
||||
return atom(0)
|
||||
end
|
||||
|
||||
local benchmarks = {
|
||||
atom = function(_, source: any)
|
||||
for _ = 1, 500 do
|
||||
source({ count = math.random(1, 2) })
|
||||
source(math.random(1, 2))
|
||||
end
|
||||
end,
|
||||
|
||||
computed = function(_, source: any)
|
||||
computed(function()
|
||||
return { count = 2 * source().count }
|
||||
return 2 * source()
|
||||
end)
|
||||
for _ = 1, 500 do
|
||||
source({ count = math.random(1, 2) })
|
||||
end
|
||||
end,
|
||||
|
||||
computed_nested = function(_, source: any)
|
||||
local double = computed(function()
|
||||
return { count = 2 * source().count }
|
||||
end)
|
||||
computed(function()
|
||||
return { count = 2 * double().count }
|
||||
end)
|
||||
for _ = 1, 500 do
|
||||
source({ count = math.random(1, 2) })
|
||||
source(math.random(1, 2))
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue