internal JsValue KeepAliveDeleteProperty(int slot, string name) { #if DEBUG_TRACE_API Console.WriteLine("deleting prop " + name); #endif // TODO: This is pretty slow: use a cache of generated code to make it faster. var obj = KeepAliveGet(slot); if (obj != null) { #if DEBUG_TRACE_API Console.WriteLine("deleting prop " + name + " type " + type); #endif if (typeof(IDictionary).IsAssignableFrom(obj.GetType())) { IDictionary dictionary = (IDictionary)obj; if (dictionary.Contains(name)) { dictionary.Remove(name); return(_convert.ToJsValue(true)); } } return(_convert.ToJsValue(false)); } return(JsValue.Error(KeepAliveAdd(new IndexOutOfRangeException("invalid keepalive slot: " + slot)))); }
public void SetVariable(string name, object value) { if (name == null) { throw new ArgumentNullException("name"); } CheckDisposed(); JsValue a = _convert.ToJsValue(value); jsengine_set_variable(_engine, name, a); jsvalue_dispose(a); // TODO: Check the result of the operation for errors. }
public void SetVariable(string name, object value) { if (name == null) { throw new ArgumentNullException("name"); } CheckDisposed(); JsValue a = _convert.ToJsValue(value); JsValue b = jscontext_set_variable(_context, name, a); #if DEBUG_TRACE_API Console.WriteLine("Cleaning up return value from set variable"); #endif jsvalue_dispose(a); jsvalue_dispose(b); // TODO: Check the result of the operation for errors. }