如何在没有Promise
的情况下编写此代码,仅使用Observable
?
private method(auth: any) {
return new Promise((resolve, reject) => {
auth.onAuthStateChanged(value => resolve(value));
})
}
目前它返回Promise<any>
,我想让它返回Observable<any>
... onAuthStateChanged有这个签名:
onAuthStateChanged(nextOrObserver, error, completed) returns function()