From 3f357f46ebce35e67420ed54d9159296d046e28f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 3 Oct 2018 15:54:57 -0700 Subject: [PATCH] Fix the `no_modules` example by fixing `--browser` Recent refactorings forgot a case of emitting code for `cachedTextDecoder`! --- crates/cli-support/src/js/mod.rs | 2 ++ examples/no_modules/index.html | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index d71b0867..38d57d5b 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1088,6 +1088,8 @@ impl<'a> Context<'a> { ", s) ); self.global(&format!("let cached{0} = new l{0}('utf-8');", s)); + } else { + self.global(&format!("let cached{0} = new {0}('utf-8');", s)); } } diff --git a/examples/no_modules/index.html b/examples/no_modules/index.html index 5430a145..edc58334 100644 --- a/examples/no_modules/index.html +++ b/examples/no_modules/index.html @@ -30,7 +30,9 @@ // here we tell bindgen the path to the wasm file so it can run // initialization and return to us a promise when it's done - wasm_bindgen('./no_modules_bg.wasm').then(run); + wasm_bindgen('./no_modules_bg.wasm') + .then(run) + .catch(console.error);