Siubaak / sval

A javascript interpreter written in javascript
https://jsbin.com/kehahiqono/edit?js,console
MIT License
379 stars 50 forks source link

behavior of async code exection #84

Closed XDinEuro closed 2 years ago

XDinEuro commented 2 years ago

Hi,

I am wondering if the Sval.run() can also be a asynchronous call, which means in playground, this log console.log('End: ' + interpreter.exports.end) will be printed after the intermiediate print in executed code ,like this

"Sval Version: 0.4.8"
1
2
3
"End: true"

If not, is there a way to get the status of the code execution? How can I easily know if the code execution is finished?

Siubaak commented 2 years ago

https://jsbin.com/kuzorobuqo/edit?js,console

You should callback or emit an event to notify if an async exection finished

XDinEuro commented 2 years ago

https://jsbin.com/kuzorobuqo/edit?js,console

You should callback or emit an event to notify if an async exection finished

thanks, this will solve the issue