-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 console support to web-sys #450
Comments
Building
|
@jannikkeye, can you minimize the test case and file a bug upstream? |
I'm not entirely sure since I'm rather new to webidl but it seems that But in console.webidl it appears inside the namespace console: wasm-bindgen/crates/web-sys/webidls/available/Console.webidl Lines 14 to 76 in 3578a83
|
In case I'm wrong, here's a minimal example to reproduce the issue with webidl-rs: [Exposed=(Window)]
namespace console {
const boolean IS_NATIVE_CONSOLE = true;
}; |
Two thoughts:
|
If you comment out the incorrect [Exposed=(Window,Worker,WorkerDebugger,Worklet,System),
ClassString="Console",
ProtoObjectHack]
namespace console {
// ... which I'm guessing means "these are exposed on the ( So should web-sys be something like #[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str); // not the correct type
} and then, how do you stop name collisions from functions with the same name in different namespaces? Should web-sys generate modules to match namespaces? |
@derekdreery That's basically what is suggested in #253. I think getting webidl namespace support first would be very helpful to get the Console.webidl up and running properly. |
Thanks for linking the issue :) |
Brain dump: |
Now that #678 has landed, what's left to do for this issue? |
@migerh @eminence I'm work towards adding variadic support in #726. After that lands, I'll modify the webidl frontend to emit variadic functions (where the last arg is a slice/vec). There's also variadic the other way, as in passing a rust callback that is called variadically by javascript. I think we need this to support some callbacks, e.g. for events. |
This is a tracking issue for adding support for the console API to the
web-sys
crate.General info on the console API: https://developer.mozilla.org/en-US/docs/Web/API/Console
How to add support for new Web APIs to
web-sys
: https://rustwasm.github.io/wasm-bindgen/web-sys/supporting-more-web-apis.htmlInterfaces
Here is a list of interfaces we need to support:
Console
Example
examples/
to useweb-sys
The text was updated successfully, but these errors were encountered: