You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with some delegate patterns from a WASM codebase and need to create 2 class instances, where the second one is taking the first one as a constructor parameter.
// main.jsconstwrappedWorker=wrap(worker);constFirstClassProxyInstance=awaitnewwrappedWorker.FirstClass(...params);// we make some changesawaitFistClassProxy.someMethod(...params)`
// and try to create the second classconstSecondClassProxyInstance=awaitnewwrappedWorker.SecondClass(FirstClassProxyInstance)
How I see it, I should not expose the raw SecondClass, but a helper method which would implement a theoretical Comlink.original that takes the proxy from one thread and gets the original:
The text was updated successfully, but these errors were encountered:
ivancuric
changed the title
Possible to get reference to original object from a proxy?
Possible to get reference to original object from a proxy (Remote)?
Mar 15, 2023
ivancuric
changed the title
Possible to get reference to original object from a proxy (Remote)?
Possible to get reference to original object from a proxy (ProxyMarked)?
Mar 15, 2023
ivancuric
changed the title
Possible to get reference to original object from a proxy (ProxyMarked)?
Possible to get reference to original object from a proxy?
Mar 16, 2023
I have another propose - Comlink.weakProxy(obj) (similar with C++ weak_ptr) or Comlink.reference(obj) which means, when will transfer back, will referenced back. Also such type can be transferred into proxy, and from another side. Doing reference database, and object which points into that reference by uuid. When transfers back, ID is checking and backing reference.
Is it possible to get a reference to the original object from a proxy? Similarly to how Immer has
original()
?I am working with some delegate patterns from a WASM codebase and need to create 2 class instances, where the second one is taking the first one as a constructor parameter.
So basically this:
How I see it, I should not expose the raw
SecondClass
, but a helper method which would implement a theoreticalComlink.original
that takes the proxy from one thread and gets the original:Is it possible to do something like this?
The text was updated successfully, but these errors were encountered: