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:
richard 2024-06-11 17:13:43 -07:00 • committed by GitHub
parent fbc86d22c6
commit a90d131fed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 290 additions and 98 deletions

View file

@ -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,
}