3.0.19 • Published 6 years ago

modelproxy-engine-wx v3.0.19

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

modelproxy-engine-fetch

使用微信小程序提供的调用接口的方法来调用接口的engine。 构造函数中默认传入一个方法,这个方法必须返回promise。

支持的设置

  1. settings.timeout 设置超时时间,默认为5s。
  2. settings.cache 设置缓存,key为fullPath+method,类型为Promise。没有持久化。
  3. settings.expire 设置缓存过期时间,单位为毫秒。
  4. settings.reload 强制不使用缓存

安装

npm i modelproxy-engine-wx

demo

    import { FetchEngine } from 'modelproxy-engine-wx';

    const engine = new FetchEngine(wepy.request);

    engine.init();

    /**
    * 请求真正的数据接口
    * 返回数据
    */
    engine.use(async (ctx, next) => {
        // 处理想要的逻辑
        await next();
    });

    const proxy = new modelProxy.Proxy();

    proxy.addEngines({"wx":engine});

Licence

MIT

3.0.19

6 years ago

3.0.0

6 years ago

2.1.3

6 years ago

2.0.40

6 years ago

2.0.35

6 years ago

2.0.34

6 years ago

2.0.33

6 years ago

2.0.32

6 years ago

2.0.31

6 years ago

2.0.30

6 years ago

2.0.29

6 years ago

2.0.28

6 years ago

2.0.24

6 years ago

2.0.19

6 years ago

2.0.18

6 years ago

2.0.17

6 years ago

2.0.16

6 years ago

2.0.15

6 years ago

2.0.14

6 years ago

2.0.13

6 years ago

2.0.12

6 years ago

2.0.11

6 years ago

2.0.7

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago