예제 #1
0
        public static void Test()
        {
            WSFunctionTemplate t = WSFunctionTemplate.New();

            t.Set("func_property", WSNumber.New(1));

            WSTemplate proto_t = t.PrototypeTemplate();

            proto_t.Set("proto_method", WSFunctionTemplate.New());
            proto_t.Set("proto_const", WSNumber.New(2));

            WSObjectTemplate instance_t = t.InstanceTemplate();

            instance_t.Set("instance_property", WSNumber.New(3));

            WSFunction function = t.GetFunction();
            WSObject   instance = function.NewInstance();

            WSFunctionTemplate parent = t;
            WSFunctionTemplate child  = WSFunctionTemplate.New();

            child.Inherit(parent);

            WSFunction child_function = child.GetFunction();
            WSObject   child_instance = child_function.NewInstance();
        }
예제 #2
0
 public WSObjectTemplate InstanceTemplate()
 {
     return(WSObjectTemplate.New());
 }
예제 #3
0
 /// <summary>
 /// 原型模板
 /// </summary>
 /// <returns></returns>
 public WSObjectTemplate PrototypeTemplate()
 {
     return(WSObjectTemplate.New());
 }