mix init options in the Module-global

This commit is contained in:
Johannes Rieken 2021-08-30 14:16:41 +02:00
parent 0926fad1e2
commit 12d727fd49
4 changed files with 48 additions and 29 deletions

View file

@ -1,2 +1,23 @@
return Parser;
}));
for (const name of Object.getOwnPropertyNames(ParserImpl.prototype)) {
Object.defineProperty(Parser.prototype, name, {
value: ParserImpl.prototype[name],
enumerable: false,
writable: false,
})
}
Parser.Language = Language;
Module.onRuntimeInitialized = () => {
ParserImpl.init();
resolveInitPromise();
};
});
}
}
return Parser;
}();
if (typeof exports === 'object') {
module.exports = TreeSitter;
}