https://github.com/raxjs/universal-api
Universal apis for web and miniapps.
https://github.com/raxjs/universal-api
mini-program miniapp rax universal-apis wechat wechat-mini-program
Last synced: 9 months ago
JSON representation
Universal apis for web and miniapps.
- Host: GitHub
- URL: https://github.com/raxjs/universal-api
- Owner: raxjs
- Created: 2019-09-20T15:08:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-18T02:59:59.000Z (over 2 years ago)
- Last Synced: 2025-04-28T21:04:39.286Z (10 months ago)
- Topics: mini-program, miniapp, rax, universal-apis, wechat, wechat-mini-program
- Language: TypeScript
- Homepage: https://universal-api.js.org/
- Size: 7.6 MB
- Stars: 270
- Watchers: 17
- Forks: 62
- Open Issues: 27
-
Metadata Files:
- Readme: README.en-US.md
Awesome Lists containing this project
README
Uni API is a cross-terminal API solution that supports applets and web containers.
---
๐ **Multi-container support** Currently supports Web, WeChat Mini Programs, Toutiao Mini Programs, Ali Mini Programs, Baidu Smart Programs and Kuaishou Mini Programs
๐ **Rich API** Cover 90+ API implementations
๐ฏ **Complete documentation** Provide bilingual documents and rich samples
0๏ธโฃ **No framework dependency** No framework dependency, pure native implementation, compatible with any framework
๐ **Extreme volume** Support on-demand loading, eliminate useless code according to the environment
๐๐ป **Easy to use, fast access** Provide a complete Typescripts statement, so you can get rid of the documentation and immerse yourself in programming
## Quick start
> Take @uni/toast as an example
```bash
$ npm install @uni/toast
```
```js
import { showToast } from '@uni/toast';
// string
showToast('Hi');
// object
showToast({
content: 'hello',
type: 'success',
duration: 1000,
success: () => {
console.log('toast')
}
});
// promise
showToast({
content: 'hello',
type: 'success',
duration: 1000,
}).then(() => {});
```
## Docs
Official site: [https://universal-api.js.org/](https://universal-api.js.org/)
## Example
Wechat MiniProgram
Alibaba MiniApp
## Contribute code
Please read [Rax Contribution Code Guide](https://github.com/alibaba/rax/wiki/CONTRIBUTING), Understand the basic specifications.
### Get started
```
$ git clone git@github.com:raxjs/universal-api.git
$ npm install
$ npm run build
```
### Debug API
Take @uni/toast as an example:
```
$ npm run build toast
$ npm run build:demo
$ cd demos
$ npm i
$ npm run start # ๅฏๅจ้กน็ฎ๏ผๆๅผๅฐ็จๅบ IDE ่ฟ่ก่ฐ่ฏ
```
## Protocol
[BSD License](https://github.com/raxjs/miniapp/blob/master/LICENSE)