Skip to content

Instantly share code, notes, and snippets.

@gre
Created May 6, 2015 09:07
Show Gist options
  • Save gre/fadd75d340f183444e44 to your computer and use it in GitHub Desktop.
Save gre/fadd75d340f183444e44 to your computer and use it in GitHub Desktop.
import World from "./World";
import Physics from "./Physics";
// expose all the things
window.ENGINE = { World: World, Physics: Physics };
const Physics = {
applyForce: function(x, y) { ... },
processEntity: function(entity) { ... }
};
export default Physics;
const World = {
the_answer_to_everything: 42
};
export default World;
@mrspeaker
Copy link

ES6 destructuring makes this nice too - you can pull out bits only when you need them

import Engine from './Engine';
const {Lander, Astronaut, WaveCharge} = Engine;
const {Encouter, Mission, Junkyard} = Engine;

Etc... not sure why Junkyard is part of your engine though ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment