Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 858c4a5

Browse files
committed
Implement SystemLoader constructor
This adds a SystemLoader constructor function used internally to inherit from Loader. `System` then becomes an instance of SystemLoader and `SystemLoader` is set as `System.constructor`. This way downstream code can do something like: ```js class MyLoader extends System.constructor { fetch() { } } ``` And doing so will have access to `super` and the like. I also added in `esnext` to build this and use es6 classes. We talked about doing it this way and it is *much* more elegant in my opinion (just look at the minimal amount of code changes). Let me know if this adds too much code or you don't like it for some reason and I'll implement this as regular old constructor functions, but I thought this turned out really well. Fixes #199
1 parent 55177e1 commit 858c4a5

File tree

8 files changed

+1506
-29
lines changed

8 files changed

+1506
-29
lines changed

Gruntfile.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,23 @@ module.exports = function (grunt) {
1818
'lib/system.js'
1919
]
2020
},
21-
concat: {
21+
esnext: {
2222
dist: {
2323
src: [
24-
// 'node_modules/rsvp/dist/rsvp.js',
2524
'node_modules/when/es6-shim/Promise.js',
2625
'lib/loader.js',
2726
'lib/system.js'
2827
],
2928
dest: 'dist/<%= pkg.name %>.js'
3029
},
30+
loader: {
31+
src: [ 'lib/loader.js' ],
32+
dest: 'dist/loader.js'
33+
},
34+
system: {
35+
src: [ 'lib/system.js' ],
36+
dest: 'dist/system.js'
37+
},
3138
polyfillOnly: {
3239
src: [
3340
'lib/loader.js',
@@ -57,10 +64,10 @@ module.exports = function (grunt) {
5764
}
5865
});
5966

60-
grunt.loadNpmTasks('grunt-contrib-concat');
6167
grunt.loadNpmTasks('grunt-contrib-jshint');
6268
grunt.loadNpmTasks('grunt-contrib-uglify');
69+
grunt.loadNpmTasks('grunt-esnext');
6370

6471
grunt.registerTask('lint', ['jshint']);
65-
grunt.registerTask('default', [/*'jshint', */'concat', 'uglify']);
72+
grunt.registerTask('default', [/*'jshint', */'esnext', 'uglify']);
6673
};

0 commit comments

Comments
 (0)