Wasm: Throw an exception if Parser is constructed before init() resolves
This commit is contained in:
parent
621efeb543
commit
068f7b1a0c
1 changed files with 4 additions and 0 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue