repackaging: all the repackaging changes squashed
This commit is contained in:
1
modules/@angular/platform-browser-dynamic/src/facade
Symbolic link
1
modules/@angular/platform-browser-dynamic/src/facade
Symbolic link
@ -0,0 +1 @@
|
||||
../../facade/src
|
@ -1,7 +1,7 @@
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||
import {XHR} from '@angular/compiler';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {global} from '../../src/facade/lang';
|
||||
import {PromiseWrapper} from '../../src/facade/promise';
|
||||
|
||||
/**
|
||||
* An implementation of XHR that uses a template cache to avoid doing an actual
|
||||
|
@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var compiler_1 = require('@angular/compiler');
|
||||
var promise_1 = require('../../src/facade/promise');
|
||||
var lang_1 = require('../../src/facade/lang');
|
||||
var XHRImpl = (function (_super) {
|
||||
__extends(XHRImpl, _super);
|
||||
function XHRImpl() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
XHRImpl.prototype.get = function (url) {
|
||||
var completer = promise_1.PromiseWrapper.completer();
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
xhr.responseType = 'text';
|
||||
xhr.onload = function () {
|
||||
// responseText is the old-school way of retrieving response (supported by IE8 & 9)
|
||||
// response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
|
||||
var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText;
|
||||
// normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
|
||||
var status = xhr.status === 1223 ? 204 : xhr.status;
|
||||
// fix status code when it is 0 (0 status is undocumented).
|
||||
// Occurs when accessing file resources or on Android 4.1 stock browser
|
||||
// while retrieving files from application cache.
|
||||
if (status === 0) {
|
||||
status = response ? 200 : 0;
|
||||
}
|
||||
if (200 <= status && status <= 300) {
|
||||
completer.resolve(response);
|
||||
}
|
||||
else {
|
||||
completer.reject("Failed to load " + url, null);
|
||||
}
|
||||
};
|
||||
xhr.onerror = function () { completer.reject("Failed to load " + url, null); };
|
||||
xhr.send();
|
||||
return completer.promise;
|
||||
};
|
||||
return XHRImpl;
|
||||
}(compiler_1.XHR));
|
||||
exports.XHRImpl = XHRImpl;
|
||||
//# sourceMappingURL=xhr_impl.js.map
|
@ -1,6 +1,6 @@
|
||||
import {PromiseWrapper, PromiseCompleter} from 'angular2/src/facade/promise';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {XHR} from '@angular/compiler';
|
||||
import {PromiseWrapper, PromiseCompleter} from '../../src/facade/promise';
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
|
||||
export class XHRImpl extends XHR {
|
||||
get(url: string): Promise<string> {
|
||||
|
Reference in New Issue
Block a user