crappy-coder / astrid

2D Game Engine and Application Framework
2 stars 0 forks source link

ES6: refactor to use imports and classes #6

Closed crappy-coder closed 9 years ago

crappy-coder commented 9 years ago

Update code to use the legacy but newly revived in es6, import statement. This will allow the compiler to know which files/modules/code a particular file/class needs.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

fabslab commented 9 years ago

yip will do this at the same time as https://github.com/JTJustCodes/astrid/issues/4, and then wont have to worry about dependency ordering in the build either

fabslab commented 9 years ago

Can track this on branch https://github.com/JTJustCodes/astrid/tree/ES6 I'm close to setting up a build for it

fabslab commented 9 years ago

I set up a basic debug build script in that branch that compiles the files to ES5 and node modules, and bundles them up into one file, but now that everything isn't global the consumer of the library doesn't have access to much, only the main Application class.

We should start grouping files into folders, have an index file in each folder that exports everything within that folder, then have a main index file in root (could still be Application.js) that imports each group index and exports them all together under one variable, so everything is accessible again. Users could do their own builds if they want, for more optimization when they know they are only going to use certain modules.

fabslab commented 9 years ago

I'm gonna merge my ES6 branch into master now, it should be easy to review still since everything is new files. Then I'll make a new issue for the organisation of the code into directories.