示例#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 WSNumber ToNumber()
 {
     return(WSNumber.New(0));
 }