This repository has been archived by the owner on Apr 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
system.setup.js
78 lines (73 loc) · 2.66 KB
/
system.setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* System configuration for Angular 2.
*/
(function (global) {
// map tells the System loader where to look for things
var map = {
'app': 'app', // 'dist',
'@angular/core': 'ng:core/bundles/core.umd.js',
'@angular/common': 'ng:common/bundles/common.umd.js',
'@angular/compiler': 'ng:compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'ng:platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'ng:platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'ng:http/bundles/http.umd.js',
'@angular/router': 'ng:router/bundles/router.umd.js',
'@angular/forms': 'ng:forms/bundles/forms.umd.js',
'rxjs': 'rxjs',
'jquery': 'scripts/bundles/jquery-2.1.4.js',
'bootstrap/js/bootstrap': 'scripts/bundles/bootstrap.js',
'admin-lte/js/app': 'scripts/bundles/app.js',
'jquery/jquery.hammer': 'scripts/bundles/jquery.hammer.js',
'hammerjs': 'scripts/bundles/hammer.js',
'hammerjs/hammer': 'scripts/bundles/hammer.js',
'jquery/jquery.slimscroll': 'scripts/bundles/jquery.slimscroll.js',
'pnotify': 'scripts/bundles/pnotify.custom.js',
'pNotify/pnotify-adapter': 'scripts/bundles/pnotify-adapter.js',
'signalr/signalr': 'scripts/bundles/signalr.js',
'leaflet/leaflet': 'scripts/bundles/leaflet-src.js',
'fastclick/fastclick': 'scripts/bundles/fastclick.js'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' }
};
var config = {
paths: {
'ng:': '@angular/'
},
map: map,
packages: packages
}
System.config(config);
})(this);
function backupModule() {
return new Promise(function (resolve, reject) {
if (typeof module !== 'undefined' && module.hasOwnProperty('exports')) {
window.module = module;
module = undefined;
}
console.log('mod backuped');
resolve(true);
});
}
function restoreModule() {
return new Promise(function (resolve, reject) {
if (window.hasOwnProperty('module')) {
module = window.module;
}
console.log('mod restored');
resolve(true);
});
}
backupModule()
.then(function () {
// return System.import('jquery');
})
.then(function () {
return restoreModule();
})
.then(function () {
return System.import('app/main');
})
.then(null, console.error.bind(console));