Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Serializing the entire engine

$
0
0
Hello!

1) How do I get access to all root objects from inside the CLR?

You can do something like this:
foreach (var name in engine.Script.GetDynamicMemberNames()) {
    var obj = engine.Script[name];
    // do something with obj
}
This should return all global properties that aren't standard JavaScript built-ins.

2) Any advice on things to look out for?

Not knowing what kind of objects might be in your script environment, it's difficult to say. Would you expect many .NET objects, and if so, what types? What about script functions? Some script functions may be serializable, but some may not (e.g., those created via bind()). One thing you should definitely avoid is using JSON.stringify() to serialize .NET objects.

Good luck, and please let us know if you encounter any specific issues!

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>