I developed a unique operator that utilizes the this
keyword, but I am encountering an issue where it always returns undefined. Even though I used bind
to pass this
into the function.
My special operator
function shouldLoadNewOptimizationData() {
return filter(function([p1,p2,p3]) {
// some logic
if(){
this.store.dispatch()...
}
})
}
How to use my custom operator
effect = createEffect(()=> this.actions$.pipe(
ofType(//action type),
withLatestFrom(
//...selectors
),
shouldLoadNewOptimizationData().bind(this),
// more operators..
)
)