function Privilege(){
  // 如果已存在对应的实例
 if(typeof Privilege.instance === 'object'){
     return Privilege.instance
 }

 this.privilegeList = []
 this.getPrivilege = function() {
   return this.privilegeList
 }
 this.setPrivilege = function(list) {
  if (Object.prototype.toString.call(list) == "[object Array]") {
    this.privilegeList = list
  } else {
    this.privilegeList = []
  }
 }
 this.hasPrivilege = function(value) {
  return this.privilegeList.includes(value)
 }

 // 缓存
 Privilege.instance =this
 return this
}

export function hasPrivilege(value) {
  return new Privilege().hasPrivilege(value)
}

export function getPrivilege() {
  return new Privilege().getPrivilege()
}

export function setPrivilege(list) {
  return new Privilege().setPrivilege(list)
}