“middleware” Pipe方法

描述

middleware是iFlow中间件组API,和对应是各类型和中间件用法完全等价。

  • 中间件对照表如下:
中间件API 直接接口API return return value 异步 说明
stateWillInitialize setInitializeValue 可添加初始化的值 初始化中间件
actionWillStart addInterceptor 可改变action参数 Action前置中间件
stateWillChange addMiddleware 可改变set的值 State Change前置中间件
stateDidChange addObserver - State Change后置通知中间件
actionDidEnd addListener - Action后置通知中间件

用法

pipe.middleware({
    stateWillInitialize: (...args) => {},
    actionWillStart: (...args) => {},
    stateWillChange: (...args) => {},
    stateDidChange: (...args) => {},
    actionDidEnd: (...args) => {},
})
pipe.middleware(
  {
    stateWillInitialize: (...args) => {},
    actionWillStart: (...args) => {},
    stateWillChange: (...args) => {},
    stateDidChange: (...args) => {},
    actionDidEnd: (...args) => {},
  },
  {
    stateWillInitialize: (...args) => {},
    actionWillStart: (...args) => {},
    stateWillChange: (...args) => {},
    stateDidChange: (...args) => {},
    actionDidEnd: (...args) => {},
  })
pipe
.middleware({
    stateWillInitialize: (...args) => {},
    actionWillStart: (...args) => {},
    stateWillChange: (...args) => {},
    stateDidChange: (...args) => {},
    actionDidEnd: (...args) => {},
})
.middleware({
    stateWillInitialize: (...args) => {},
    actionWillStart: (...args) => {},
    stateWillChange: (...args) => {},
    stateDidChange: (...args) => {},
    actionDidEnd: (...args) => {},
})

results matching ""

    No results matching ""