diff --git a/lib/binding_web/binding.js b/lib/binding_web/binding.js index 5aa116fa..027a0b89 100644 --- a/lib/binding_web/binding.js +++ b/lib/binding_web/binding.js @@ -27,6 +27,10 @@ class Parser { } constructor() { + if (TRANSFER_BUFFER == null) { + throw new Error('You must first call Parser.init() and wait for it to resolve.'); + } + C._ts_parser_new_wasm(); this[0] = getValue(TRANSFER_BUFFER, 'i32'); this[1] = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32');