本文整理匯總了TypeScript中@angular/http.XHRBackend.createConnection方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript XHRBackend.createConnection方法的具體用法?TypeScript XHRBackend.createConnection怎麽用?TypeScript XHRBackend.createConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/http.XHRBackend
的用法示例。
在下文中一共展示了XHRBackend.createConnection方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Error
const scheduleTask = (_task: Task) => {
task = _task;
scheduled = true;
this.lastConnection = backend.createConnection(request);
sub = (this.lastConnection.response as Observable<Response>)
.subscribe(
res => savedResult = res,
err => {
if (!scheduled) {
throw new Error('invoke twice');
}
savedError = err;
scheduled = false;
task.invoke();
},
() => {
if (!scheduled) {
throw new Error('invoke twice');
}
scheduled = false;
task.invoke();
});
};
示例2: scheduleTask
this.response = scheduleTask(() => {
this.connection = backend.createConnection(this.request);
return this.connection.response as Observable<any>;
});
示例3: delegate
delegate(request: Request): Observable<Response> {
this.lastConnection = this.backend.createConnection(request);
return this.lastConnection.response as Observable<Response>;
}