New Promise Constructor

2013-09-11 Thread Andrea Marchesini
Hi all,

I just want to inform that I'm landing a patch that changes the DOM Promise 
constructor.
DOM Promise is disabled by pref but I know that there are a few existing pieces 
of code that already use them.

The old constructor was based the PromiseResolver object.
Now we get rid of this object and the new constructor works in this way:

callback PromiseInit = void (object resolve, object reject);
[Constructor(PromiseInit init)]
interface Promise {...}

Best Regards,
Andrea


___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: New Promise Constructor

2013-09-11 Thread Boris Zbarsky

On 9/11/13 2:13 PM, Marcos Caceres wrote:

callback PromiseInit = void (object resolve, object reject);
[Constructor(PromiseInit init)]
interface Promise {...}



What members does PromiseInit dictionary have? ^_^


It's not a dictionary.  It's a callback, like the IDL snippet above says.

So you'd do it like so in practice:

  var p = new Promise(function(resolve, reject) {
// do stuff here.
  });

-Boris
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: New Promise Constructor

2013-09-11 Thread Marcos Caceres


On 11/09/2013, at 6:11 PM, Andrea Marchesini amarches...@mozilla.com wrote:

 Hi all,
 
 I just want to inform that I'm landing a patch that changes the DOM Promise 
 constructor.
 DOM Promise is disabled by pref but I know that there are a few existing 
 pieces of code that already use them.
 
 The old constructor was based the PromiseResolver object.
 Now we get rid of this object and the new constructor works in this way:
 
 callback PromiseInit = void (object resolve, object reject);
 [Constructor(PromiseInit init)]
 interface Promise {...}
 

What members does PromiseInit dictionary have? ^_^




 Best Regards,
 Andrea
 
 
 ___
 dev-platform mailing list
 dev-platform@lists.mozilla.org
 https://lists.mozilla.org/listinfo/dev-platform
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: New Promise Constructor

2013-09-11 Thread Marcos Caceres


On 11/09/2013, at 8:18 PM, Boris Zbarsky bzbar...@mit.edu wrote:

 On 9/11/13 2:13 PM, Marcos Caceres wrote:
 callback PromiseInit = void (object resolve, object reject);
 [Constructor(PromiseInit init)]
 interface Promise {...}
 
 What members does PromiseInit dictionary have? ^_^
 
 It's not a dictionary.  It's a callback, like the IDL snippet above says.
 
 So you'd do it like so in practice:
 
  var p = new Promise(function(resolve, reject) {
// do stuff here.
  });

Ah, right! got confused as almost everything else in the platform with *Init is 
a dictionary. Maybe that should be renamed PromiseCallback. 

 
 -Boris
 ___
 dev-platform mailing list
 dev-platform@lists.mozilla.org
 https://lists.mozilla.org/listinfo/dev-platform
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform