Project

General

Profile

1
/**
2
 * @license Angular v4.4.6
3
 * (c) 2010-2017 Google, Inc. https://angular.io/
4
 * License: MIT
5
 */
6
(function (global, factory) {
7
	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/compiler'), require('@angular/core'), require('@angular/common'), require('@angular/platform-browser')) :
8
	typeof define === 'function' && define.amd ? define(['exports', '@angular/compiler', '@angular/core', '@angular/common', '@angular/platform-browser'], factory) :
9
	(factory((global.ng = global.ng || {}, global.ng.platformBrowserDynamic = global.ng.platformBrowserDynamic || {}),global.ng.compiler,global.ng.core,global.ng.common,global.ng.platformBrowser));
10
}(this, (function (exports,_angular_compiler,_angular_core,_angular_common,_angular_platformBrowser) { 'use strict';
11

    
12
/*! *****************************************************************************
13
Copyright (c) Microsoft Corporation. All rights reserved.
14
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
15
this file except in compliance with the License. You may obtain a copy of the
16
License at http://www.apache.org/licenses/LICENSE-2.0
17

    
18
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
20
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
21
MERCHANTABLITY OR NON-INFRINGEMENT.
22

    
23
See the Apache Version 2.0 License for specific language governing permissions
24
and limitations under the License.
25
***************************************************************************** */
26
/* global Reflect, Promise */
27

    
28
var extendStatics = Object.setPrototypeOf ||
29
    ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30
    function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
31

    
32
function __extends(d, b) {
33
    extendStatics(d, b);
34
    function __() { this.constructor = d; }
35
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
}
37

    
38
/**
39
 * @license Angular v4.4.6
40
 * (c) 2010-2017 Google, Inc. https://angular.io/
41
 * License: MIT
42
 */
43
/**
44
 * @license
45
 * Copyright Google Inc. All Rights Reserved.
46
 *
47
 * Use of this source code is governed by an MIT-style license that can be
48
 * found in the LICENSE file at https://angular.io/license
49
 */
50
var ResourceLoaderImpl = (function (_super) {
51
    __extends(ResourceLoaderImpl, _super);
52
    function ResourceLoaderImpl() {
53
        return _super !== null && _super.apply(this, arguments) || this;
54
    }
55
    ResourceLoaderImpl.prototype.get = function (url) {
56
        var resolve;
57
        var reject;
58
        var promise = new Promise(function (res, rej) {
59
            resolve = res;
60
            reject = rej;
61
        });
62
        var xhr = new XMLHttpRequest();
63
        xhr.open('GET', url, true);
64
        xhr.responseType = 'text';
65
        xhr.onload = function () {
66
            // responseText is the old-school way of retrieving response (supported by IE8 & 9)
67
            // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
68
            // by IE10)
69
            var response = xhr.response || xhr.responseText;
70
            // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
71
            var status = xhr.status === 1223 ? 204 : xhr.status;
72
            // fix status code when it is 0 (0 status is undocumented).
73
            // Occurs when accessing file resources or on Android 4.1 stock browser
74
            // while retrieving files from application cache.
75
            if (status === 0) {
76
                status = response ? 200 : 0;
77
            }
78
            if (200 <= status && status <= 300) {
79
                resolve(response);
80
            }
81
            else {
82
                reject("Failed to load " + url);
83
            }
84
        };
85
        xhr.onerror = function () { reject("Failed to load " + url); };
86
        xhr.send();
87
        return promise;
88
    };
89
    return ResourceLoaderImpl;
90
}(_angular_compiler.ResourceLoader));
91
ResourceLoaderImpl.decorators = [
92
    { type: _angular_core.Injectable },
93
];
94
/** @nocollapse */
95
ResourceLoaderImpl.ctorParameters = function () { return []; };
96
/**
97
 * @license
98
 * Copyright Google Inc. All Rights Reserved.
99
 *
100
 * Use of this source code is governed by an MIT-style license that can be
101
 * found in the LICENSE file at https://angular.io/license
102
 */
103
var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
104
    _angular_platformBrowser.ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS,
105
    {
106
        provide: _angular_core.COMPILER_OPTIONS,
107
        useValue: { providers: [{ provide: _angular_compiler.ResourceLoader, useClass: ResourceLoaderImpl }] },
108
        multi: true
109
    },
110
    { provide: _angular_core.PLATFORM_ID, useValue: _angular_common.ɵPLATFORM_BROWSER_ID },
111
];
112
/**
113
 * @license
114
 * Copyright Google Inc. All Rights Reserved.
115
 *
116
 * Use of this source code is governed by an MIT-style license that can be
117
 * found in the LICENSE file at https://angular.io/license
118
 */
119
/**
120
 * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
121
 * ResourceLoader.
122
 *
123
 * The template cache needs to be built and loaded into window.$templateCache
124
 * via a separate mechanism.
125
 */
126
var CachedResourceLoader = (function (_super) {
127
    __extends(CachedResourceLoader, _super);
128
    function CachedResourceLoader() {
129
        var _this = _super.call(this) || this;
130
        _this._cache = _angular_core.ɵglobal.$templateCache;
131
        if (_this._cache == null) {
132
            throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
133
        }
134
        return _this;
135
    }
136
    CachedResourceLoader.prototype.get = function (url) {
137
        if (this._cache.hasOwnProperty(url)) {
138
            return Promise.resolve(this._cache[url]);
139
        }
140
        else {
141
            return Promise.reject('CachedResourceLoader: Did not find cached template for ' + url);
142
        }
143
    };
144
    return CachedResourceLoader;
145
}(_angular_compiler.ResourceLoader));
146
/**
147
 * @license
148
 * Copyright Google Inc. All Rights Reserved.
149
 *
150
 * Use of this source code is governed by an MIT-style license that can be
151
 * found in the LICENSE file at https://angular.io/license
152
 */
153
/**
154
 * @license
155
 * Copyright Google Inc. All Rights Reserved.
156
 *
157
 * Use of this source code is governed by an MIT-style license that can be
158
 * found in the LICENSE file at https://angular.io/license
159
 */
160
/**
161
 * @module
162
 * @description
163
 * Entry point for all public APIs of the common package.
164
 */
165
/**
166
 * @stable
167
 */
168
var VERSION = new _angular_core.Version('4.4.6');
169
/**
170
 * @license
171
 * Copyright Google Inc. All Rights Reserved.
172
 *
173
 * Use of this source code is governed by an MIT-style license that can be
174
 * found in the LICENSE file at https://angular.io/license
175
 */
176
/**
177
 * @experimental
178
 */
179
var RESOURCE_CACHE_PROVIDER = [{ provide: _angular_compiler.ResourceLoader, useClass: CachedResourceLoader }];
180
/**
181
 * @stable
182
 */
183
var platformBrowserDynamic = _angular_core.createPlatformFactory(_angular_compiler.platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
184

    
185
exports.RESOURCE_CACHE_PROVIDER = RESOURCE_CACHE_PROVIDER;
186
exports.platformBrowserDynamic = platformBrowserDynamic;
187
exports.VERSION = VERSION;
188
exports.ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS;
189
exports.ɵResourceLoaderImpl = ResourceLoaderImpl;
190

    
191
Object.defineProperty(exports, '__esModule', { value: true });
192

    
193
})));
194
//# sourceMappingURL=platform-browser-dynamic.umd.js.map
(5-5/8)