var Auth = {
auth : 0,
init : function(auth) {
this.auth = auth;
return this;
},
addAuth : function(auth){
this.auth = this.auth | parseInt(auth);
return this.auth;
},
isAuth : function(auth){
if ( (this.auth & parseInt(auth)) == 0){
return false;
}
return true;
},
delAuth : function(auth){
this.auth = this.auth & ~parseInt(auth);
return this.auth;
}
}
var oAuth = Auth.init(1);
console.log("init auth:\n " + oAuth.auth);
oAuth.addAuth(2);
console.log("add auth:\n" + oAuth.auth);
console.log("is auth: \n" + oAuth.isAuth(2));
oAuth.addAuth(4);
console.log("add auth:\n" + oAuth.auth);
//oAuth.delAuth(2);
//console.log("add auth:\n" + oAuth.auth);
console.log("is auth: \n" + oAuth.isAuth(8));
auth : 0,
init : function(auth) {
this.auth = auth;
return this;
},
addAuth : function(auth){
this.auth = this.auth | parseInt(auth);
return this.auth;
},
isAuth : function(auth){
if ( (this.auth & parseInt(auth)) == 0){
return false;
}
return true;
},
delAuth : function(auth){
this.auth = this.auth & ~parseInt(auth);
return this.auth;
}
}
var oAuth = Auth.init(1);
console.log("init auth:\n " + oAuth.auth);
oAuth.addAuth(2);
console.log("add auth:\n" + oAuth.auth);
console.log("is auth: \n" + oAuth.isAuth(2));
oAuth.addAuth(4);
console.log("add auth:\n" + oAuth.auth);
//oAuth.delAuth(2);
//console.log("add auth:\n" + oAuth.auth);
console.log("is auth: \n" + oAuth.isAuth(8));