Deleting a hosted object.

Oct 1, 2013 at 7: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.
Coordinator
Oct 1, 2013 at 8:20 PM
Edited Oct 1, 2013 at 8: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:
engine.Script.foo = myObject;
// OR engine.Script["foo"] = myObject;
This creates a normal script property that can be reassigned or deleted as necessary.

Cheers!
Oct 3, 2013 at 7:05 PM
Thx.