Created
April 9, 2018 12:22
-
-
Save FagnerMartinsBrack/2ed6855f567c2d5f645f1e58945c719a to your computer and use it in GitHub Desktop.
(Medium) - Commands And Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it should be human.openDoor(door)