I'm looking for the best way to clear all properties on a global object.
I want to reuse the global object for later script executions.
I did not see a Clear() method on the Object class.
I want all functions and vars to die.
Is there a better or more efficient way than this?
Or should I create a patch that adds a Clear() method to the Object class?
--------------------------------------------------------------------------
Local<Array> arrProps = obj->GetPropertyNames();
uint32_t iLen = arrProps->Length();
Local<String> name;
for(uint32_t i=0; i<iLen; i++)
{
name = arrProps->Get(i)->ToString();
obj->Delete(name);
}
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users