Preserving the state of a closure
My main task is to create a file representing the current state of the executing application, to transmit it to another device and to reload the state in the destination device.
The basic solution I adopted is to navigate the window object and to save all its descendant properties using JSON as base format for exportation and extending it to implement some features:
- preserving object reference, even if cyclic (dojox.json.ref library)
- support for timers
- non-numeric properties of arrays
- reference to DOM elements
The most important task I need to solve now is exportation of closures. At this moment I didn't know how to implement this feature.
Anyone know if there is a way to directly access the [[scope]] property? Or another way to preserve the state of a closure?