Last active
April 7, 2020 00:52
-
-
Save matthewstokeley/545d8030a95b5acd026873ba69ca65dd to your computer and use it in GitHub Desktop.
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
// an incredibly quick sketch | |
// goal: a 4-line version of redux | |
// 0.0.1 | |
// actions | |
const ACTIONS = { | |
"nav-toggle": "BIND_NAV_TOGGLE" | |
} | |
// event store | |
const EVENTS = [ 'nav-toggle' ] | |
// model | |
<button data-event="nav-toggle" data-event-state="false"></button> | |
let e = EVENTS | |
for ( let i = 0 ; i < e.length; i++ ) { | |
events.addEventListener( e[ i ], function( event ) { ACTIONS[ e[ i ] ].call( this ) } ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment