What is the difference between finally and finalize in rxjs

ぐ巨炮叔叔 提交于 2019-12-21 10:16:43

问题


I am using RxJS and I can see there are 2 function in RxJS 5.5.2 available. Is the .finally will be removed and it will be placed in side pipe() from RxJS 6.0.0 on wards is the reason or there are any other changes?

Are they both same and now final call is inside pipe()?

Or they have any notable difference?

finalize

method()
   .pipe(
     finalize(() => {
      // do some operation
     })
   )

finally

method()
  .finally(() => {
    // do your operation
  })

回答1:


Both are same functionality wise both does same operation of calling once observable is completed but difference is which version of rxjs you are using

Before v5.5 it is been called as finally

From v5.5 it is renamed to finalize(due to keyword restriction), because of the introduction to pipeable Operators which helps better tree shaking. For more info please check this link



来源:https://stackoverflow.com/questions/50276665/what-is-the-difference-between-finally-and-finalize-in-rxjs

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