huawei-no

判断是否是华为设备并禁止华为设备使用,抵制华为践踏劳动者尊严!

Usage no npm install needed!

<script type="module">
  import huaweiNo from 'https://cdn.skypack.dev/huawei-no';
</script>

README

huawei-no

介绍

判断是否是华为设备并禁止华为设备使用
目前支持判断华为和荣耀设备
华为尊重每一位劳动者,践踏劳动者的尊严可耻之极!

使用方法

安装方法

npm install huawei-no

使用方法

使用代码

let hw = require('huawei-no');
let res = hw.isHW(type); //判断是否是华为设备,返回布尔值 true 和 false
hw.HWNO(type, callback); //判断如果是华为设备,警告或执行回调方法

//事例
hw.HWNO('all', '请勿使用华为设备访问本系统!');
hw.HWNO('huawei', res => {
  if (res) {
    alert('请勿使用华为设备访问本系统!');
  } else {
    console.log('感谢使用非华为设备!');
  }
});
let res = hw.isHW();
if (res) {
  alert('请勿使用华为设备访问本系统!');
} else {
  console.log('感谢使用非华为设备!');
}

参数说明

Type值
Type值 默认值 说明
all true 全部华为系产品
huawei false 华为产品
honor false 荣耀产品
CallBack值
callback类型 默认值 说明
true console.log('警告:您正在使用华为设备,该系统禁止华为设备访问!') 和 alert('警告:您正在使用华为设备,该系统禁止华为设备访问!')
function false 执行回调function
string false console.log(string) 和 alert(string)