[ortc] RTCRtpSender send should return a promise

murillo128 has just created a new issue for 
https://github.com/openpeer/ortc:

== RTCRtpSender send should return a promise ==
Not sure if it is duplicated, but just in cae.

Currently, RTCRtpSender.send() returns void and error is launched if 

> This event must be fired if an issue is found with the 
RTCRtpParameters object passed to send(), that is not immediately 
detected.

According to the promise best practices 
(https://www.w3.org/2001/tag/doc/promises-guide), about when to use 
promises this should be changed to a promise instead of an error 
handler 

> Because  promises can be subscribed to even after they’ve already 
been fulfilled or rejected, they can be very useful for a certain 
class of "event." When something only happens once, and authors often 
want to observe the status of it after it’s .already occurred, 
providing a promise that becomes fulfilled when that eventuality comes
 to pass gives a very convenient API.

> The prototypical example of such an "event" is a loaded indicator: a
 resource such as an image, font, or even document, could provide a 
loaded property that is a promise that becomes fulfilled only when the
 resource has fully loaded (or becomes rejected if there’s an error 
loading the resource). Then, authors can always queue up actions to be
 executed once the resource is ready by doing 
resource.loaded.then(onLoaded, onFailure). This will work even if the 
resource was loaded already, queueing a microtask to execute onLoaded.
 This is in contrast to an event model, where if the author is not 
subscribed at the time the event fires, that information is lost.



Please view or discuss this issue at 
https://github.com/openpeer/ortc/issues/469 using your GitHub account

Received on Friday, 15 April 2016 13:43:08 UTC