Playground.js is a framework for your javascript based games. It gives you out-of-box access to essentials like mouse, keyboard, sound and well designed architecture that you can expand to your needs.
If this pull request is merged, some users (such as myself) will now be able to load playground.js by simply using require (the CommonJS-style of importing modules), depending on their set-up:
var playground = require('playground');
Much easier for people like me, and it will definitely make it easier for developers to organize their code. Again, no need of script tags.
This pull request adds a package.json file for the sake of compatibility with npm, a .gitignore file to ignore the node_modules folder, enhances plugins/playground.three.js to be loadable via require and enhances build.js to distribute a CommonJS-equivalent of the build files.
Now, what about plugins?
The answer to that is to turn plugins into mixins, but only on CommonJS environments, so that those who are not using CommonJS, they won't be affected. As a preview of how things would work out, I converted playground.three.js so that you can see it for ourself. And, in order to use the mixin, one can manually extend the Application class with the plugin, like so:
var Application = require('playground.js').Application;
var playgroundThreeMixin = require('playground.js/plugins/playground.three.js').playgroundThreeMixin;
Object.assign(Application.prototype, playgroundThreeMixin);
// Application should now be extended.
If this pull request is merged, some users (such as myself) will now be able to load playground.js by simply using
require
(the CommonJS-style of importing modules), depending on their set-up:Much easier for people like me, and it will definitely make it easier for developers to organize their code. Again, no need of script tags.
This pull request adds a
package.json
file for the sake of compatibility with npm, a.gitignore
file to ignore thenode_modules
folder, enhancesplugins/playground.three.js
to be loadable viarequire
and enhances build.js to distribute a CommonJS-equivalent of the build files.Now, what about plugins?
The answer to that is to turn plugins into mixins, but only on CommonJS environments, so that those who are not using CommonJS, they won't be affected. As a preview of how things would work out, I converted
playground.three.js
so that you can see it for ourself. And, in order to use the mixin, one can manually extend theApplication
class with the plugin, like so:Demo | Source