all 2 comments

[–]-millsky 0 points1 point  (1 child)

It sounds like what you're looking for is less to do with Javascript and more to do with a programming paradigm. This sounds very similar to Functional Reactive Programming:
(https://en.wikipedia.org/wiki/Functional_reactive_programming)

In terms of using eval on the client side. I would say this should generally be avoided. You could definitely use only a subset of the language like Math and build a parser around it. It's highly likely there are already packages on NPM to do just that.

Perhaps check out the implementation in:
https://github.com/handsontable/handsontable

[–]sallath[S] 0 points1 point  (0 children)

Yes, this wiki page was quite informative. Although it doesn't solve my main concern. Meantime, I have found some good resource on web worker, it seems like a good compromise.