コード例 #1
0
    public override ObjectHandle Initialize(bool isConstructCall, params InternalHandle[] args)
    {
        base.Initialize(isConstructCall, args);

        Console.WriteLine("\r\nInitializing V8DotNetTester ...\r\n");

        Console.WriteLine("Creating test property 1 (adding new JSProperty directly) ...");

        var myProperty1 = new JSProperty(Engine.CreateValue("Test property 1"));

        this.Properties.Add("testProperty1", myProperty1);

        Console.WriteLine("Creating test property 2 (adding new JSProperty using the IV8ManagedObject interface) ...");

        var myProperty2 = new JSProperty(Engine.CreateValue(true));

        this["testProperty2"] = myProperty2;

        Console.WriteLine("Creating test property 3 (reusing JSProperty instance for property 1) ...");

        // Note: This effectively links property 3 to property 1, so they will both always have the same value, even if the value changes.
        this.Properties.Add("testProperty3", myProperty1); // (reuse a value)

        Console.WriteLine("Creating test property 4 (just creating a 'null' property which will be intercepted later) ...");

        this.Properties.Add("testProperty4", JSProperty.Empty);

        Console.WriteLine("Creating test property 5 (test the 'this' overload in V8ManagedObject, which will set/update property 5 without calling into V8) ...");

        this["testProperty5"] = (JSProperty)Engine.CreateValue("Test property 5");

        Console.WriteLine("Creating test property 6 (using a dynamic property) ...");

        InternalHandle strValHandle = Engine.CreateValue("Test property 6");

        this.AsDynamic.testProperty6 = strValHandle;

        Console.WriteLine("Creating test function property 1 ...");

        var funcTemplate1 = Engine.CreateFunctionTemplate("_" + GetType().Name + "_");

        _MyFunc = funcTemplate1.GetFunctionObject(TestJSFunction1);
        this.AsDynamic.testFunction1 = _MyFunc;

        Console.WriteLine("\r\n... initialization complete.");

        return(Handle);
    }
コード例 #2
0
ファイル: V8Function.cs プロジェクト: balu92/Fougerite
 public V8Function(IV8Function proxy)
     : base(proxy)
 {
 }
コード例 #3
0
ファイル: V8Function.cs プロジェクト: tongxin3267/v8dotnet
 public V8Function(IV8Function proxy)
     : base(proxy)
 {
 }