Skip to content

Commit

Permalink
refactor: Changed event is now an RxSignal (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
InvisibleWater authored Oct 4, 2024
1 parent 539802f commit 96fb4c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/settings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@quenty/remoting": "file:../remoting",
"@quenty/rx": "file:../rx",
"@quenty/rxbinderutils": "file:../rxbinderutils",
"@quenty/rxsignal": "file:../rxsignal",
"@quenty/servicebag": "file:../servicebag",
"@quenty/signal": "file:../signal",
"@quenty/statestack": "file:../statestack",
Expand Down
9 changes: 3 additions & 6 deletions src/settings/src/Shared/Setting/SettingProperty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local require = require(script.Parent.loader).load(script)

local SettingsDataService = require("SettingsDataService")
local Rx = require("Rx")
local RxSignal = require("RxSignal")

local SettingProperty = {}
SettingProperty.ClassName = "SettingProperty"
Expand Down Expand Up @@ -69,15 +70,11 @@ function SettingProperty:__index(index)
return self._definition:GetDefaultValue()
end
elseif index == "Changed" then
return {
Connect = function(callback)
return self:Observe():Pipe({
return RxSignal.new(self:Observe():Pipe({
-- TODO: Handle scenario where we're loading and .Value changes because of what
-- we queried.
Rx.skip(1);
}):Subscribe(callback)
end;
}
}))
elseif index == "DefaultValue" then
return self._definition:GetDefaultValue()
elseif SettingProperty[index] then
Expand Down

0 comments on commit 96fb4c7

Please sign in to comment.