简体   繁体   English

在redux-saga中调用`call`时,是否计划运行异步操作?

[英]When invoking `call` in redux-saga, is the async action scheduled to be run?

I see a saga: 我看到了一个传奇:

export function* mySaga({ username, password }) {
    yield call(login, username, password);
}

Does the invocation of this saga schedule the login function to be called by the saga middleware or does it, instead, only create and configure an effect that is returned and used by the middleware to schedule the call to login ? 这个saga的调用是否安排了saga中间件调用的login功能,还是只创建并配置了一个由中间件返回并用于安排login调用的效果?

It merely configures an effect to be used by the middleware . 它仅配置要由中间件使用的效果

Put another way, the Generator will yield plain Objects containing instructions, and the redux-saga middleware will take care of executing those instructions and giving back the result of their execution to the Generator. 换句话说,Generator将产生包含指令的普通对象,redux-saga中间件将负责执行这些指令并将其执行结果返回给Generator。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM