Surma
Surma
This is a fairly straight forward example of Comlink that should definitely work (my tests pretty much have this example). Can you provide a reproduction case? My hunch is that...
Can you proxy the entire object instead? ```diff - const obj = { cb: Comlink.proxy(callback) } - await remoteFunction(obj); + const obj = { cb: callback } + await remoteFunction(Comlink.proxy(obj));...
Hm... an opt-in is not the worst idea. I might prototype something here.
Do you mind adding a test for this as well?
Are you talking about `@import`? Because yes, I totally did not add support for that. Can you give me a small code sample that breaks?
Older versions of Comlink supported generators by turning them into [async generators](https://caniuse.com/#feat=mdn-javascript_functions_method_definitions_async_generator_methods), but support for async generators was lacking at the time. I should revisit this now.
Hey @Gaubee. Sorry for the late reply here. I don’t quite follow the use-case to be honest and it’s a significant amount of code. Let me try to explain what...
`Comlink.wrap(globalThis)` is most likely not correct here. That should probably be `Comlink.wrap(nodeEndpoint(require('worker_threads').parentPort))`. If that doesn’t work, can you put your example in a gist or something?
cc @patrickkettner
Which version of Comlink are you using? Do you have a small test case that misbehaves? Comlink definitely supports copying _and_ transferring TypedArrays. I just [added some tests](https://github.com/GoogleChromeLabs/comlink/commit/d6f21053d322e0ce55d5eab3566e773926b11b06) to make...