mp-promise
v2.0.1
Published
api promisify
Downloads
5
Readme
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);