Skip to content

Instantly share code, notes, and snippets.

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 FagnerMartinsBrack/2ed6855f567c2d5f645f1e58945c719a to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/2ed6855f567c2d5f645f1e58945c719a to your computer and use it in GitHub Desktop.
(Medium) - Commands And Events
const Door = () => {
// ...
};
const Brain = () => {
// ...
};
const Human = () => {
let brain = new Brain();
return {
openDoor: (door) => {
brain.putHandForward();
brain.grabHandleFor(door);
brain.twistHandToLeft();
brain.releaseHand();
}
};
};
// Initialization
let human = Human();
let door = Door();
human.open(door);
@sacros
Copy link

sacros commented Apr 14, 2018

it should be human.openDoor(door)

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