-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wrapChain function #311
base: master
Are you sure you want to change the base?
Conversation
This is great! @surma - Got time to take a look? |
Here's the version with the breaking change to |
Woohoo! 🎉 Any thoughts on this PR? It would help us with embermap/ember-cli-fastboot-testing#61 |
Hey, apologies for being so quiet. I’m currently a bit swamped, but I’ll put this on the top of my priority list for when I have a bit of downtime. Please be patient! Thank you :) |
Okay, I finally had some time to look at this. I definitely see the value of supporting chain-style APIs, especially with their increasing popularity. However, it’s a significant code increase (1K, ~300B gzip’d) that and I don’t think I want every Comlink user to pay. I could, however, see providing your What do you think? |
Would the breaking change version (master...CvX:wrap-chain-breaking) be out of the question? It does preserve compatibility with the usual cases ( What it breaks, are only cases without But if that isn’t a viable option, a separate module would do. |
As I said, my concerns are mostly about file size, not necessarily breaking changes. A separate module is definitely my preferred way forward. |
Hm, the byte size difference between the gzipped I'd say a downside of a separate module is an increased API surface. You'd have to decide which comlink "flavor" to use in each case. |
Hi @surma - Any updates on this one? |
Apologies. I’ll get back to this soon. Chrome Dev Summit is happening and, uh, it’s stressful 😅 Please don’t give up on me and keep pinging if you think I forgot. |
Hi @surma - I hope you're recovered from the Dev Summit! Just pinging you again, per your request 😃 |
Hey @surma - Checking in again. Any updates on this one? |
This PR adds support for the method chaining:
I've added this functionality in a separate
wrapChain()
function, because while almost fully back-compatible with thewrap()
function, it has a breaking change:Messages are passed between contexts only after you
await
/callthen()
.For example this works with
wrap()
:But with the new implementation,
thing(done)
isn't enough to actually call a function.An example of changed
wrap()
test:If this breaking change is acceptable (with a major version bump), I can update this PR and merge those two
wrap
functions.