将 Firebase onAuth 回调绑定到可观察对象
Binding Firebase onAuth callback to an observable
我正在尝试将回调结果绑定到 Firebase 中的 onAuth()
请求到 RxJS observable。
let auth = Observable.bindCallback(ref.onAuth);
let source = auth();
let subscription = source.subscribe(
(x) => console.log(x),
(e) => console.log(e)
);
我收到错误:
Cannot read property 'O' of undefined at BoundCallbackObservable.X.Ig [as callbackFunc]
在此先感谢您的帮助!
看来问题是执行的上下文回调函数不正确。这应该可以解决:
let auth = Observable.bindCallback(ref.onAuth.bind(ref));
我正在尝试将回调结果绑定到 Firebase 中的 onAuth()
请求到 RxJS observable。
let auth = Observable.bindCallback(ref.onAuth);
let source = auth();
let subscription = source.subscribe(
(x) => console.log(x),
(e) => console.log(e)
);
我收到错误:
Cannot read property 'O' of undefined at BoundCallbackObservable.X.Ig [as callbackFunc]
在此先感谢您的帮助!
看来问题是执行的上下文回调函数不正确。这应该可以解决:
let auth = Observable.bindCallback(ref.onAuth.bind(ref));