-
-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
This could be a complete nightmare, but would be a great help in making these libraries more user friendly. The upcoming v4 release fixes all of the weird quirks, so it should be ready enough to use...
A lot of the fixes are smallish syntax things, i.e.
-- Quenty promises
function HumanoidTracker:PromiseNextHumanoid()
if self.Humanoid.Value then
return Promise.resolved(self.Humanoid.Value)
end
if self._maid._nextHumanoidPromise then
return self._maid._nextHumanoidPromise
end
local promise = Promise.new()
local conn = self.Humanoid.Changed:Connect(function(newValue)
if newValue then
promise:Resolve(newValue)
end
end)
promise:Finally(function()
conn:Disconnect()
end)
self._maid._nextHumanoidPromise = promise
return promise
end
-- Evaera promises
function HumanoidTracker:PromiseNextHumanoid()
if self.Humanoid.Value then
return Promise.resolve(self.Humanoid.Value)
end
if self._maid._nextHumanoidPromise then
return self._maid._nextHumanoidPromise
end
local promise = Promise.fromEvent(self.Humanoid.Changed, function(val)
return val ~= nil
end)
self._maid._nextHumanoidPromise = promise
return promise
endWould also need to add a special case for the maid accepting promises, as these don't implement a .destroy method. I've been slowly converting libraries as I use them, would PRs be accepted on some separate branch?
Metadata
Metadata
Assignees
Labels
No labels