@shed/platform
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@shed/platform

🔨 以微信小游戏为基准,统一各小游戏平台提供的API,并 Promise

各个小游戏平台均实现了 IPlatform 接口

当使用 @shed/cli 编译到某个平台时,会利用 rolluptree shaking 自动将其他无关平台的代码删掉。

安装

npm install @shed/platform

或使用 yarn

yarn add @shed/platform

用法

let api:IPlatform = Platform.get();
api.xxx();

如果在微信平台,上边的代码经过 @shed/cli 编译后相当于

wx.xxx();

环境判断

let platform = Platform.get();

if(platform.isWX){ 
    console.log('是微信平台'); 
}

if(platform.isH5){
    console.log('是Web平台');
}

Contributors

License

The MIT License

Readme

Keywords

Package Sidebar

Install

npm i @shed/platform

Weekly Downloads

4

Version

0.2.0

License

MIT

Unpacked Size

167 kB

Total Files

37

Last publish

Collaborators

  • nshen121
  • shed121