lua-carbon / carbon

The standard library Lua never had!
zlib License
30 stars 6 forks source link

Break apart Nanotube #41

Open LPGhatguy opened 9 years ago

LPGhatguy commented 9 years ago

I'm finding that I'm using Carbon.Nanotube for a lot of event propagation (because dammit, it works amazingly) as well as root events. I think I should break it apart into a couple objects, because I don't need to :Loop() over a UI element.

LPGhatguy commented 9 years ago

For a 1.1 feature, this would mean adding more objects with reduced functionality from Carbon.Nanotube; Nanotube itself will stay API compatible.

LPGhatguy commented 9 years ago

As a possible addition to Nanotube, it would be nice to be able to chain events and have them occur one after another instead of all at the same time. For example:

Nanotube.Global:After(5, function()
    print("5 seconds have elapsed!")
end):After(5, function()
    print("5 more seconds have elapsed!")
end)

In Carbon 1.0, this will execute two different functions after 5 seconds have elapsed. I'd like to change this to make one function execute followed by another function, though I'm not sure what the best way to accomplish this would be.

Perhaps an extended Promise object that adds timed event chains would be a possibility.