universal-miniapp-api-interceptor
v1.0.0
Published
MiniApp api interceptor
Downloads
3
Readme
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'
});