Implement a polyfill attribute for imports

Allow using imported APIs under alternative names, such as prefixed
names, for web APIs when the exact API differs across browsers.
This commit is contained in:
Alex Crichton
2018-09-28 13:17:37 -07:00
parent 11bcaf42d5
commit 3c14f7a6eb
11 changed files with 172 additions and 2 deletions

View File

@ -189,6 +189,7 @@ impl Bindgen {
let mut cx = js::Context {
globals: String::new(),
imports: String::new(),
imports_post: String::new(),
footer: String::new(),
typescript: format!("/* tslint:disable */\n"),
exposed_globals: Default::default(),
@ -208,6 +209,7 @@ impl Bindgen {
js::SubContext {
program,
cx: &mut cx,
polyfills: Default::default(),
}.generate()?;
}
cx.finalize(stem)?