We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to map functions from the chrome.tabs JavaScript namespace, but when I do:
chrome.tabs
#[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = "chrome.tabs")] pub fn query(query_info: &JsValue, callback: &dyn Fn(JsValue)); }
I get the error:
error: expected an identifier --> src/chrome_tabs.rs:23:35 | 23 | #[wasm_bindgen(js_namespace = "chrome.tabs")] | ^^^^^^^^^^^^^
May be related code:
wasm-bindgen/crates/backend/src/ast.rs
Line 72 in df34cf8
The text was updated successfully, but these errors were encountered:
Yeah, this is covered by #951
As a workaround, you can do this:
#[wasm_bindgen] extern "C" { pub type Tabs; #[wasm_bindgen(method)] pub fn query(this: &Tabs, query_info: &JsValue, callback: &dyn Fn(JsValue)); } #[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = chrome)] pub fn tabs() -> Tabs; }
Now you can use tabs().query(...)
tabs().query(...)
Sorry, something went wrong.
That gave Uncaught TypeError: chrome.tabs is not a function
Uncaught TypeError: chrome.tabs is not a function
but with static like #951 worked:
#[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = chrome)] static tabs: Tabs; }
Thanks again!
Oops, I forgot to add getter, though static works as well.
getter
static
No branches or pull requests
I'm trying to map functions from the
chrome.tabs
JavaScript namespace, but when I do:I get the error:
May be related code:
wasm-bindgen/crates/backend/src/ast.rs
Line 72 in df34cf8
The text was updated successfully, but these errors were encountered: