Coder Social home page Coder Social logo

raxjs / universal-api Goto Github PK

View Code? Open in Web Editor NEW
258.0 18.0 63.0 7.78 MB

Universal apis for web and miniapps.

Home Page: https://universal-api.js.org/

JavaScript 10.21% TypeScript 89.79%
universal-apis miniapp wechat wechat-mini-program mini-program rax

universal-api's Introduction

Rax

Uni API 是一套支持小程序和 Web 容器的跨端 API 解决方案。


🎉 多容器支持 目前支持 Web、微信小程序、头条小程序、阿里小程序、百度小程序、快手小程序

🐂 API 丰富 覆盖 90+ API 实现

😯 文档完善 提供双语文档、丰富样例

0️⃣ 无框架依赖 无框架依赖,纯原生实现,可以兼容任意框架

🚀 极致体积 支持按需加载,按环境剔除无用代码

👍🏻 简易使用,快速接入 提供完善的 TypeScript 声明,让你可以摆脱文档,沉浸编程

快速使用

以 @uni/toast 为例

$ npm install @uni/toast
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(() => {});

文档

官方站点:https://universal-api.js.org/

示例

微信小程序 支付宝小程序

贡献代码

请首先阅读 Rax 贡献代码指南,了解基础的规范。

起步

$ git clone [email protected]:raxjs/universal-api.git
$ yarn
$ yarn build

调试 API

$ yarn demo:init
$ yarn demo:dev

然后使用小程序 IDE 即可开始调试:

更新版本

API package 版本统一维护在根目录下的api-config.js,以 @uni/toast 为例:

module.exports = {
  toast: {
    path: 'src/packages/interactive/toast/src/index.ts',
    pkgInfo: [
      {
        version: '1.0.5',
        name: '@uni/toast',
      },
    ],
  },
}
参数 含义 默认值
path 在源文件的路径 -
pkgInfo npm包的属性(同packagejson写法) -
needCommonUtil 是否需要公共utils true
unNeedSplit 是否需要安环境分包 false

大包版本需要更新根目录下的 package.json 的 version

协议

BSD License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.