mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-05-03 09:32:16 +00:00
Fix imports of TextEncoder/TextDecoder
This commit is contained in:
parent
bfde5e236c
commit
76cc1ca295
@ -642,8 +642,9 @@ impl<'a> Context<'a> {
|
|||||||
"));
|
"));
|
||||||
} else if !self.config.browser {
|
} else if !self.config.browser {
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
if (typeof window === 'undefined')
|
const TextEncoder = typeof window === 'object' && window.TextEncoder
|
||||||
var TextEncoder = require('util').TextEncoder;
|
? window.TextEncoder
|
||||||
|
: require('util').TextEncoder;
|
||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
@ -667,8 +668,9 @@ impl<'a> Context<'a> {
|
|||||||
"));
|
"));
|
||||||
} else if !self.config.browser {
|
} else if !self.config.browser {
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
if (typeof window === 'undefined')
|
const TextDecoder = typeof window === 'object' && window.TextDecoder
|
||||||
var TextDecoder = require('util').TextDecoder;
|
? window.TextDecoder
|
||||||
|
: require('util').TextDecoder;
|
||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
|
Loading…
x
Reference in New Issue
Block a user