Skip to content

Instantly share code, notes, and snippets.

@niabot
Created May 10, 2016 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niabot/4130f2dc6f2e42a1d20c81fba1889c43 to your computer and use it in GitHub Desktop.
Save niabot/4130f2dc6f2e42a1d20c81fba1889c43 to your computer and use it in GitHub Desktop.
SystemJS gives up if bundles option is used
// Neither then() or catch() are called back by SystemJS
System.import('asysshop')
.then(function (shop) {
shop.start();
})
.catch(function (err) {
console.log(err);
});
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 __());
};
System.register("asysform/base", [], function(exports_13, context_13) {
"use strict";
var __moduleName = context_13 && context_13.id;
var Random;
return {
setters:[],
execute: function() {
Random = (function () {
function Random() {
}
Random.float = function (min, max) {
return Math.random() * (max - min) + min;
};
Random.integer = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
Random.alphanum = function (len) {
var s = '';
for (var i = 0; i < len; i++) {
s += Random.ALPHANUM.charAt(Random.integer(0, Random.ALPHANUM.length - 1));
}
return s;
};
Random.ALPHANUM = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
return Random;
}());
exports_13("Random", Random);
}
};
});
System.register("asysform", ["asysform/base"], function(exports_25, context_25) {
"use strict";
var __moduleName = context_25 && context_25.id;
var base;
var Version, VERSION;
return {
setters:[
function (base_8) {
base = base_8;
}],
execute: function() {
exports_25("base", base);
Version = (function () {
function Version(major, minor, build, revision) {
if (major === void 0) { major = 0; }
if (minor === void 0) { minor = 0; }
if (build === void 0) { build = 0; }
if (revision === void 0) { revision = 0; }
this._major = major;
this._minor = minor;
this._build = build;
this._revision = revision;
}
Object.defineProperty(Version.prototype, "major", {
get: function () {
return this._major;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Version.prototype, "minor", {
get: function () {
return this._minor;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Version.prototype, "build", {
get: function () {
return this._build;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Version.prototype, "revision", {
get: function () {
return this._revision;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Version.prototype, "versionFull", {
get: function () {
return [this.major, this.minor, this.build, this.revision].join('.');
},
enumerable: true,
configurable: true
});
Object.defineProperty(Version.prototype, "versionShort", {
get: function () {
return [this.major, this.minor].join('.');
},
enumerable: true,
configurable: true
});
Version.prototype.toString = function () {
return 'Version (' + this.versionFull + ')';
};
return Version;
}());
exports_25("Version", Version);
exports_25("VERSION", VERSION = new Version(1, 0, 0, 0));
}
};
});
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 __());
};
System.register("asysshop", ['asysform', "asysform/base"], function(exports_7, context_7) {
"use strict";
var __moduleName = context_7 && context_7.id;
var af, base;
function start() {
console.log('It runs'); // This should be in the log
}
exports_7("start", start);
return {
setters:[
function (af_3) {
af = af_3;
},
function (base_3_1) {
base = base_3_1;
}],
execute: function() {
}
};
});
System.config({
baseURL: '.',
paths: {
'*': '*.js'
},
bundles: {
'asysform': [
'asysform/base'
]
},
meta: {
'asysform': {
scriptLoad: true, // optional
format: 'register' // not recognized as register format otherwise
},
'asysshop': {
scriptLoad: true, // optional
format: 'register' // not recognized as register format otherwise
}
}
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Testpage</title>
<link rel="shortcut icon" href="favicon.ico">
<script src="system.js"></script>
<script src="config.js"></script>
<script src="app.js"></script>
</head>
<body></body>
</html>
// Replace this with SystemJS v0.19.27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment