Add a --no-modules-global flag

This can be used to configure the name of the global that's initialized so it's
not unconditionally `wasm_bindgen`.

Closes #145
This commit is contained in:
Alex Crichton
2018-04-19 13:33:58 -07:00
parent 212703671a
commit 0ade4b8cac
4 changed files with 19 additions and 2 deletions

View File

@ -21,6 +21,7 @@ pub struct Bindgen {
nodejs: bool,
browser: bool,
no_modules: bool,
no_modules_global: Option<String>,
debug: bool,
typescript: bool,
demangle: bool,
@ -42,6 +43,7 @@ impl Bindgen {
nodejs: false,
browser: false,
no_modules: false,
no_modules_global: None,
debug: false,
typescript: false,
demangle: true,
@ -68,6 +70,11 @@ impl Bindgen {
self
}
pub fn no_modules_global(&mut self, name: &str) -> &mut Bindgen {
self.no_modules_global = Some(name.to_string());
self
}
pub fn debug(&mut self, debug: bool) -> &mut Bindgen {
self.debug = debug;
self