Re: [ServiceWorker] Returning a FetchPromise from fetch() (#625)

That's how this works, yes.  Either you leak ambient authority, or naive libraries will *lose* authority.  Then-only-works-once just means that any library which chains off of a promise twice (which is totally fine for every other promise in the entire world) will break when you hand it one of these special not-really-a-promise objects.  Or if you pass the promise to two libraries, each of which chains once.

It means you can't, for example, use the promise in two combinators.  Or do a "totally safe" Promise.resolve() on the value to assimilate arbitrary thenables for your library.  Or a bunch of other things.

Then-only-works-once means it's not a Promise any more, period, and it's not a good idea. :(

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/625#issuecomment-75344284

Received on Saturday, 21 February 2015 00:29:41 UTC