问题
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