mp-promise
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

mp-promise

api promisify

Installation

npm install --save mp-promise

Getting started

💨example:

import { promisifyAll, promisify } from 'mp-promise';

const asyncApi = promisifyAll(api)

const asyncFunc = promisify(func)

WechatMiniprogram Example

// typings/index.d.ts
/// <reference path="../node_modules/mp-promise/types/index.d.ts" />

type WxApi = Omit<WechatMiniprogram.Wx, "wxp">;
declare namespace WechatMiniprogram {
  interface Wx {
    wxp: OmitNever<MpApiAsyncAll<WxApi>>;
  }
}

// miniprogram/app.ts
import { promisifyAll } from "mp-promise";
wx.wxp = promisifyAll(wx);

Readme

Keywords

none

Package Sidebar

Install

npm i mp-promise

Weekly Downloads

4

Version

2.0.1

License

MIT

Unpacked Size

4.01 kB

Total Files

6

Last publish

Collaborators

  • qq1448896454