-
Notifications
You must be signed in to change notification settings - Fork 80
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
fix: JS API shouldn't require reference to window object #6193
fix: JS API shouldn't require reference to window object #6193
Conversation
cd82643
to
730e756
Compare
730e756
to
26020ba
Compare
26020ba
to
fbdc2a8
Compare
I've tested this in the vscode extension by removing most of the polyfill we needed before. Remaining polyfill is:
I think we can get rid of the @mofojed any opinions on this? |
web/client-api/src/main/java/io/deephaven/web/client/api/WorkerConnection.java
Outdated
Show resolved
Hide resolved
metadata.set(key, info.getOptions().headers.get(key)); | ||
return null; | ||
}); | ||
return authUpdate().then(ignore -> Promise.resolve(Boolean.TRUE)); |
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.
Do we have to use Promise.resolve
in the return? I thought non-promise and promise returns from a then
both result in the same thing.
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.
In JS yes, but in Java you cannot define a method signature to return two unrelated types - union types effectively don't exist in this fashion (and while technically jvm bytecode allows method signatures to be specified based on return type, the java language doesn't have support for that). So, when we want to return a value directly, we must always wrap in Promise.resolve(...).
web/client-api/src/main/java/io/deephaven/web/client/api/grpc/UnaryWithHeaders.java
Show resolved
Hide resolved
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.
LGTM.
Also introduces a dh.Event type to use instead of the browser Event and CustomEvent types.
Fixes #5537
Fixes #6190