So basically I have an application where I want to allow the users to have client side scripts where they can edit in the application and save and edit and it becomes instantly live. I have thought about various ways to do this but everything I can think of has some pitfalls or I don't know the workings of V8 well enough to know the best way to go about it.
In the scripts users will be able to subscribe to events which are fired from within C++ back to javascript. If I re-evaluate the users script after they have edited it I don't want any previous code to still fire if these events are called.
Is there a way to do this so that V8 will dispose of the previous code? Even if it makes it invalid somehow I could always check in the Event system if the callback function is still valid and if it isn't then just get rid of it.
Any help would be greatly appreciated
[Edit]
Another thought I had was if I could somehow run it in its own context? But still have some global functions available to it ie the event system? Then "clear" the context when the user updates the script?