Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save context state in Noesis Javascript.net

I'm using the noesis javascript.net library in my C# MVC3 application.

Is it possible to save a snapshot of a javascript context object and then reload that snapshot into a new javascript context instance?

like image 968
Scottingham Avatar asked Feb 18 '26 03:02

Scottingham


1 Answers

Not sure if the original user will find this useful but I achieved this by adding a object to my context that let me write to disk (simple wrapper around TextWriter), then serialized this where this was the global scope so it captured all objects. The obvious pitfall is that not all objects are serialized proper (I used JSON.stringify for serialization). When I need to reload the context I loaded up the string from the file into a variable in my context and set the objects back.

like image 176
Joey Ciechanowicz Avatar answered Feb 19 '26 15:02

Joey Ciechanowicz