This project has moved and is read-only. For the latest updates, please go here.

Serializing Jurassic Engine state

Feb 8, 2015 at 7:37 PM
I've got this project where I'm running some JavaScript which might set up async call backs in .Net world. These callbacks are out of process, and require me to reinstantiate the Jurassic Engine in order to awake them.

What I'm wondering about is what the best way might be to go about reconstituting the current environment of a Jurassic ScriptEngine. Save all global variables, and their entire object graph, etc, seems pretty doable. But what doesn't seem that easy is dealing with closures. Let's say the following code is in JavaScript:

docNetObject.doLongRunningThing(value, function () {
console.log(value + ' was done');
});

The idea here is fairly simple. doPost is invoked in .Net land, and accepts a callback, and needs to execute the callback when the post is done. Maybe even at a time when the ScriptEngine has been disposed of.

Basically I need to recreate a ScriptEngine, and all it's associated state.
Feb 10, 2015 at 1:08 AM
Have you tried using the built-in support for ISerializable?
Nov 11, 2015 at 4:25 AM
I got that working, by the way. Have to manually dick around with some Globals I had set, but other than that: badass.