/// <summary> /// A static fuction for creating a constructor for <c>System.Type</c> /// </summary> /// <remarks>It also creates and initializes [[prototype]] and 'prototype' property to /// the same function object.</remarks> /// <param name="global">Global object</param> /// <returns>A js constructor function</returns> public static NativeTypeConstructor CreateNativeTypeConstructor(IGlobal global) { if (global == null) { throw new ArgumentNullException("global"); } JsObject proto = global.FunctionClass.New(); var inst = new NativeTypeConstructor(global, proto); inst.InitPrototype(global); inst.SetupNativeProperties(inst); return(inst); }
public static NativeTypeConstructor CreateNativeTypeConstructor( IGlobal global) { if (global == null) { throw new ArgumentNullException(nameof(global)); } JsObject typePrototype = (JsObject)global.FunctionClass.New(); NativeTypeConstructor nativeTypeConstructor = new NativeTypeConstructor(global, typePrototype); nativeTypeConstructor.InitPrototype(global); nativeTypeConstructor.SetupNativeProperties((JsDictionaryObject)nativeTypeConstructor); return(nativeTypeConstructor); }