我创建了一个访问的自定义运算符,this但它似乎总是未定义,即使我传递给this函数bind
自定义运算符
function shouldLoadNewOptimizationData() {
return filter(function([p1,p2,p3]) {
// some logic
if(){
this.store.dispatch()...
}
})
}
Run Code Online (Sandbox Code Playgroud)
自定义运算符用法
effect = createEffect(()=> this.actions$.pipe(
ofType(//action type),
withLatestFrom(
//...selectors
),
shouldLoadNewOptimizationData().bind(this),
// more operators..
)
)
Run Code Online (Sandbox Code Playgroud)