예제 #1
0
        public override object Construct(ExecutionContext GLOBAL, JSObjectBase args, ExecutionContext x)
        {
            JSObject result = new BoolObject(GLOBAL, (int)JSObject.ToNumber(GLOBAL, args.GetItem(GLOBAL, "length").GetValue(GLOBAL)) > 0 && JSObject.ToBool(GLOBAL, args.GetItem(GLOBAL, "0").GetValue(GLOBAL)));

            result.DefProp(GLOBAL, "constructor", this);
            return(result);
        }
예제 #2
0
 public BooleanFun(ExecutionContext GLOBAL)
 {
     JSObject prototype = new BoolObject(GLOBAL, false);
     DefProp(GLOBAL, "prototype", prototype, false, false, false);
     prototype.DefProp(GLOBAL, "constructor", this);
     prototype.DefProp(GLOBAL, "length", (double)1, false, false, false);
     prototype.SetItem(GLOBAL, "toString", new JSNativeMethod(typeof(BoolObject), "ToString"));
     prototype.SetItem(GLOBAL, "valueOf", new JSNativeMethod(typeof(BoolObject), "ValueOf"));
     DefProp(GLOBAL, "length", (double)1, false, false, false);
 }
예제 #3
0
        public BooleanFun(ExecutionContext GLOBAL)
        {
            JSObject prototype = new BoolObject(GLOBAL, false);

            DefProp(GLOBAL, "prototype", prototype, false, false, false);
            prototype.DefProp(GLOBAL, "constructor", this);
            prototype.DefProp(GLOBAL, "length", (double)1, false, false, false);
            prototype.SetItem(GLOBAL, "toString", new JSNativeMethod(typeof(BoolObject), "ToString"));
            prototype.SetItem(GLOBAL, "valueOf", new JSNativeMethod(typeof(BoolObject), "ValueOf"));
            DefProp(GLOBAL, "length", (double)1, false, false, false);
        }
예제 #4
0
 public override object Construct(ExecutionContext GLOBAL, JSObjectBase args, ExecutionContext x)
 {
     JSObject result = new BoolObject(GLOBAL, (int)JSObject.ToNumber(GLOBAL, args.GetItem(GLOBAL, "length").GetValue(GLOBAL)) > 0 && JSObject.ToBool(GLOBAL, args.GetItem(GLOBAL, "0").GetValue(GLOBAL)));
     result.DefProp(GLOBAL, "constructor", this);
     return result;
 }