NgRX Effect for downloading media file and dispatching progress; how to deal with the stream and throttling

南笙酒味 提交于 2019-12-06 07:30:28

I think if you don't want to have if else statement, you'll have to create different effects.

In the current one you'll dispatch a new action, e.g. DownloadEpisodeProgess, with the type in the payload. You will then create two effects that listens to this action and filter them accordingly via the type, one effect will be used to dispatch DownloadProgressEpisodes, the other one for DownloadEpisodesSuccess.

Another possible solution would be the partition operator, but I haven't used it in combination with NgRx Effects.

It is also good to keep in mind that for each subscription you make, there will be a performance cost, personally I don't really mind the if else statement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!