test: cleanup playground/src/bootstrap.ts file

This commit is contained in:
Igor Minar 2016-09-02 17:21:26 -07:00 committed by Martin Probst
parent 882efd125e
commit 645108f25b
1 changed files with 20 additions and 16 deletions

View File

@ -7,27 +7,28 @@
*/
(function(global: any /** TODO #9100 */) {
(function(global: any) {
writeScriptTag('/all/playground/vendor/core.js');
writeScriptTag('/all/playground/vendor/zone.js');
writeScriptTag('/all/playground/vendor/long-stack-trace-zone.js');
writeScriptTag('/all/playground/vendor/system.src.js');
writeScriptTag('/all/playground/vendor/Reflect.js', 'playgroundBootstrap()');
(<any>global).playgroundBootstrap = playgroundBootstrap;
global.playgroundBootstrap = playgroundBootstrap;
function playgroundBootstrap() {
// check query param
var useBundles = location.search.indexOf('bundles=false') == -1;
if (useBundles) {
System.config({
map: {
'index': 'index.js',
'@angular/core': '/packages-dist/core/bundles/core.umd.js',
'@angular/common': '/packages-dist/common/bundles/common.umd.js',
'@angular/forms': '/packages-dist/forms/bundles/forms.umd.js',
'@angular/compiler': '/packages-dist/compiler/bundles/compiler.umd.js',
'@angular/core': '/packages-dist/core/bundles/core.umd.js',
'@angular/forms': '/packages-dist/forms/bundles/forms.umd.js',
'@angular/http': '/packages-dist/http/bundles/http.umd.js',
'@angular/platform-browser':
'/packages-dist/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic':
@ -36,16 +37,18 @@
'/packages-dist/platform-webworker/bundles/platform-webworker.umd.js',
'@angular/platform-webworker-dynamic':
'/packages-dist/platform-webworker-dynamic/bundles/platform-webworker-dynamic.umd.js',
'@angular/http': '/packages-dist/http/bundles/http.umd.js',
'@angular/upgrade': '/packages-dist/upgrade/bundles/upgrade.umd.js',
'@angular/router': '/packages-dist/router/bundles/router.umd.js',
'@angular/core/src/facade': '/all/@angular/core/src/facade',
'rxjs': '/all/playground/vendor/rxjs'
'@angular/upgrade': '/packages-dist/upgrade/bundles/upgrade.umd.js',
'rxjs': '/all/playground/vendor/rxjs',
// TODO(i): remove once playground apps no longer use facades directly
'@angular/core/src/facade': '/all/@angular/core/src/facade'
},
packages: {
'app': {defaultExtension: 'js'},
'@angular/core/src/facade': {defaultExtension: 'js'},
'rxjs': {defaultExtension: 'js'}
'rxjs': {defaultExtension: 'js'},
// TODO(i): remove once playground apps no longer use facades directly
'@angular/core/src/facade': {defaultExtension: 'js'}
}
});
} else {
@ -60,15 +63,16 @@
},
packages: {
'app': {defaultExtension: 'js'},
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/forms': {main: 'index.js', defaultExtension: 'js'},
'@angular/http': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-webworker': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-webworker-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'@angular/upgrade': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {defaultExtension: 'js'}
}
@ -77,13 +81,13 @@
// BOOTSTRAP the app!
System.import('index').then(function(m: any /** TODO #9100 */) {
System.import('index').then(function(m: {main: Function}) {
m.main();
}, console.error.bind(console));
}
function writeScriptTag(scriptUrl: any /** TODO #9100 */, onload?: any /** TODO #9100 */) {
function writeScriptTag(scriptUrl: string, onload?: string) {
document.write(`<script src="${scriptUrl}" onload="${onload}"></script>`);
}
}(window));