Skip to content

Commit

Permalink
fix(Observable/Ajax): mount properties to origin readystatechange fun…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
Brooooooklyn committed Oct 11, 2016
1 parent 1bee98a commit 00fc6b1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/observable/dom/AjaxObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class AjaxSubscriber<T> extends Subscriber<Event> {
(<any>xhr.onerror).progressSubscriber = progressSubscriber;
}

xhr.onreadystatechange = function xhrReadyStateChange(e) {
function xhrReadyStateChange(e: ProgressEvent) {
const { subscriber, progressSubscriber, request } = (<any>xhrReadyStateChange);
if (this.readyState === 4) {
// normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
Expand Down Expand Up @@ -354,9 +354,10 @@ export class AjaxSubscriber<T> extends Subscriber<Event> {
}
}
};
(<any>xhr.onreadystatechange).subscriber = this;
(<any>xhr.onreadystatechange).progressSubscriber = progressSubscriber;
(<any>xhr.onreadystatechange).request = request;
xhr.onreadystatechange = xhrReadyStateChange;
(<any>xhrReadyStateChange).subscriber = this;
(<any>xhrReadyStateChange).progressSubscriber = progressSubscriber;
(<any>xhrReadyStateChange).request = request;
}

unsubscribe() {
Expand Down

0 comments on commit 00fc6b1

Please sign in to comment.