-
Notifications
You must be signed in to change notification settings - Fork 29
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
Use postMessage instead of a comlink produced MessageChannel #148
Use postMessage instead of a comlink produced MessageChannel #148
Conversation
super(); | ||
this._sendWorkerMessage = (msg: any) => { | ||
// use postMessage, but in a format, that comlink would not process. | ||
postMessage({ jMsg: msg }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if something a bit more explicit like _kernelMessage
could also work? With or without the leading _
, but having it could help communicate it's used for "internal" message handling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but then also the coincident worker needs to rename the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant for the jMsg
key, we could still keep _sendWorkerMessage
as the method name:
postMessage({ jMsg: msg }); | |
postMessage({ _kernelMessage: msg }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, got it. and it is also unique enough that comlink ignores it. (comlink ignores it if no id field is set...)
yarn.lock
Outdated
version: 4.4.1 | ||
resolution: "comlink@npm:4.4.1" | ||
checksum: 16d58a8f590087fc45432e31d6c138308dfd4b75b89aec0b7f7bb97ad33d810381bd2b1e608a1fb2cf05979af9cbfcdcaf1715996d5fcf77aeb013b6da3260af | ||
languageName: node | ||
linkType: hard | ||
|
||
"comlink@npm:^4.4.2": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the two versions of comlink
could be deduplicated with:
Line 20 in fb9c10d
"deduplicate": "yarn-berry-deduplicate -s fewer --fail", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will try this. I am not so fluent with yarn, I normally use npm. I'll be back in the evening at my dev computer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running jlpm deduplicate
at the top-level should normally perform the deduplication step.
OK, I have included the suggested changes. The deduplication affected more than just the comlink package, I hope this is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
On the current jupyterlite demo site:
jupyterlite-widgets-interact.webm
With this PR and the same notebook, it does seem to fix the interact
issue 👍
Closes #144
Fixes #133
Fixes jupyterlite/jupyterlite#1465
Fixes jupyter-book/thebe#771
Fixes jupyter/try-jupyter#54