public static bool InstanceOf(NSJSValue instance, string type) { if (instance == null || string.IsNullOrEmpty(type)) { return(false); } return(nsjs_localvalue_instanceof(instance, NSJSString.New(instance.VirtualMachine, type))); }
public void SetReturnValue(string value) { if (value == null) { this.SetReturnValue(NSJSValue.Null(this.VirtualMachine)); return; } this.SetReturnValue(NSJSString.New(this.VirtualMachine, value)); }
public virtual bool IsDefined(string key) { if (string.IsNullOrEmpty(key)) { return(false); } NSJSFunction function = this.GetFrameworkFunction(RUNTIME_ISDEFINED_PROPERTYKEY); return((function.Call(new NSJSValue[] { this, NSJSString.New(this.VirtualMachine, key) }) as NSJSInt32)?.Value == 1); }
public virtual NSJSObject GetPropertyDescriptor(string key) { if (string.IsNullOrEmpty(key)) { return(null); } NSJSFunction function = this.GetFrameworkFunction(RUNTIME_GETPROPERTYDESCRIPTOR_PROPERTYKEY); return(function.Call(new NSJSValue[] { this, NSJSString.New(this.VirtualMachine, key) }) as NSJSObject); }
public virtual void DefineProperty(string key, NSJSFunctionCallback get, NSJSFunctionCallback set) { this.InternalDefineProperty(key, (machine, function) => { NSJSValue[] s = new NSJSValue[] { this, NSJSString.New(machine, key), get == null ? NSJSValue.Undefined(machine) : NSJSFunction.New(machine, get), set == null ? NSJSValue.Undefined(machine) : NSJSFunction.New(machine, set), }; function.Call(s); }); }
public virtual NSJSValue Call(IEnumerable <string> args, out NSJSException exception) { IList <NSJSValue> argv = new List <NSJSValue>(); NSJSVirtualMachine machine = this.VirtualMachine; foreach (string s in args) { NSJSValue value = null; if (s == null) { value = NSJSValue.Null(machine); } else { value = NSJSString.New(machine, s); } if (value == null) { continue; } argv.Add(value); } return(this.Call(argv, out exception)); }