I have some old JavaScript libraries that use jQuery promises as return objects from function calls. I'm now using AngularJS which uses the $q service (inspired by the Q library). Does anybody have some generic JavaScript code to make these two different promise implementations compatible, so that jQuery promises can be used as if it where $q promises? Or something similar?
Third party promises can be wrapped with $q.when(thirdPartyPromise)
to be converted into $q promises. When the thirdPartyPromise
resolves, the $q promise resolves accordingly and $scope.$apply()
is called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With