universal-miniapp-api-interceptor

1.0.0 • Public • Published

npm

Each platform Mini App interceptor function, through the provided factory function can quickly access the multi-platform Mini App API.

Installation

$ npm install universal-miniapp-api-interceptor --save

Usage

import { apiInterceptor, apiEventHandlerInterceptor } from 'universal-miniapp-api-interceptor';

const scanCode = apiInterceptor(my, {
  method: 'scan',
  optionsInterceptor: (options: IOptions) => {
    // process options
    return options;
  },
  successInterceptor: (res: any) => {
    // process success result
    return res;
  },
  failInterceptor: (err: any) => {
    // process fail error
    return err;
  }
});

const onAccelerometerChange = listenerInterceptor(my, {
  method: 'onAccelerometerChange'
});

Readme

Keywords

Package Sidebar

Install

npm i universal-miniapp-api-interceptor

Weekly Downloads

1

Version

1.0.0

License

BSD-3-Clause

Unpacked Size

4.14 kB

Total Files

4

Last publish

Collaborators

  • rax-publisher