On 12/20/2013 05:13 PM, Kevin Smith wrote:
>
>
> Presumably certain promise libraries would try reset the global
> Promise to AssimilatingPromise (or whatever) for full parity with
> polyfilled environments, which would be fine.
>
>
> If you're using modules, you wouldn't need to mess with the global
> object. You could just import AssimilatingPromise as "Promise" into
> the current module. The local binding would override the global
> Promise variable.
>
Here is code that breaks with that solution:
```
function createParser(code) { return {then: chainedTransformation => {
...; return this; } } }
waitForFormSubmit()
.then(e => $.get(getUrlFromUrlField()))
.then(code => createParser(code, options))
```
1. If you're just importing AssimilatingPromise, the DOM-interacting
function returns a regular Promise and breaks when it gets to the
unbranded jQuery $.get
2. If you're overriding the global Promise with AssimilatingPromise, it
breaks at createParser as the parser gets assimilated (infact it will go
into an endless loop)
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss