public static void DefineGetter( JavaScriptValue obj, string keyName, Func <JavaScriptValue[], JavaScriptValue> callback ) { JavaScriptValue descriptor = JavaScriptValue.CreateObject(); descriptor.SetProperty( "get", FunctionAllocation.CreateFunction(callback) ); obj.DefineProperty( keyName, descriptor ); }
private static JavaScriptValue InternalCreateConstructor( Type type, Func <JavaScriptValue[], JavaScriptValue> func, out JavaScriptValue prototype, JavaScriptValue?extends = null ) { JavaScriptValue constructor = FunctionAllocation.CreateFunction(func); prototype = constructor.GetProperty("prototype"); if (extends.HasValue) { prototype.Prototype = extends.Value; } WireUp(constructor, type, prototype); return(constructor); }