(Medium) - Commands And Events
View original- current
This article is too short to summarise.
This file contains hidden or 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); |