This modifies the RiveScript parser for inline JavaScript macros to load them as async functions, which will allow them to use the await keyword to simplify dealing with Promises.
If your Node environment doesn't support async functions, it will parse them as normal functions as before (you won't be able to use the await keyword). For inline JS macros, your local JavaScript environment has to be modern enough to parse an async function (there's no Babel or anything at work here -- if you want async/await and want to be backwards compatible, define your macros via setSubroutine and use Babel to transpile your code).
This doesn't affect the setSubroutine() method: if you want an async function in setSubroutine, just use one:
This modifies the RiveScript parser for inline JavaScript macros to load them as
async function
s, which will allow them to use theawait
keyword to simplify dealing with Promises.If your Node environment doesn't support async functions, it will parse them as normal functions as before (you won't be able to use the
await
keyword). For inline JS macros, your local JavaScript environment has to be modern enough to parse an async function (there's no Babel or anything at work here -- if you want async/await and want to be backwards compatible, define your macros via setSubroutine and use Babel to transpile your code).This doesn't affect the
setSubroutine()
method: if you want an async function in setSubroutine, just use one:Fixes #275