1.0.0 • Published 4 years ago

universal-miniapp-api-interceptor v1.0.0

Weekly downloads
1
License
BSD-3-Clause
Repository
-
Last release
4 years ago

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'
});
1.0.0

4 years ago