Deleting a hosted object.

Oct 1, 2013 at 6:36 PM
Is there a way to delete a hosted object without restarting the scripting engine?

If I add another object with the same name, the original object is used.

I am jusing the JSCRIPT engine.
Oct 1, 2013 at 7:20 PM
Edited Oct 1, 2013 at 7:21 PM
Hello jmonasterio!

There are several ways to add host objects to the script environment. Here is one way:
engine.AddHostObject("foo", myObject);
If you do this, the global script property foo is made read-only. Any attempt to reassign or delete it is quietly ignored. This is by design.

Another way to expose a host object is as follows: = myObject;
// OR engine.Script["foo"] = myObject;
This creates a normal script property that can be reassigned or deleted as necessary.

Oct 3, 2013 at 6:05 PM