Created
May 17, 2020 11:31
-
-
Save abulka/fd8fb5250d0227ea924f27b0c081cde1 to your computer and use it in GitHub Desktop.
TodoMVC-ECS - A Different Approach
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 engine = new Engine(); | |
| engine.entity(util.uuid()).setComponent('data', {title:'make lunch', completed:true}) | |
| engine.entity(util.uuid()).setComponent('data', {title:'wash dishes', completed:false}) | |
| engine.system('report', ['data'], (entity, { data }) => { | |
| let is_or_is_not = data.completed ? 'is' : 'is not' | |
| console.log(`Todo item ${data.title} has id ${entity.name} and ${is_or_is_not} completed`) | |
| }); | |
| engine.tick() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment