rokucommunity / promises

Promise library for roku
MIT License
7 stars 4 forks source link

Fixed an issue with notifications and recursive promises #13

Closed chrisdp closed 10 months ago

chrisdp commented 10 months ago

The code supplied here results in only the "outer" being called:

recursivePromise = promises.resolve(true)

promises.onFinally(recursivePromise, sub(recursivePromise as dynamic)
    print "outer"
    promises.onThen(recursivePromise, sub(recursivePromise as dynamic)
        print "inner"
    end sub)
end sub, recursivePromise)

This PR addresses a case where registering listeners from within a callback on the same promise fails to correctly notify all the listeners.