Angular 2使用RxJS 5 Observables
:
这是您的代码的1:1翻译:
getLoginStatus: function () { return new Observable(function(observer) { gapi.auth.authorize({client_id: dataStore.getData('CLIENT_ID'), scope: dataStore.getData('SCOPES'), immediate: true},function(response){ observer.next(response); observer.complete(); }); }