Skip to content

Instantly share code, notes, and snippets.

@allanphilipbarku
Forked from bitfishxyz/complex2.js
Created February 12, 2020 02:54
Show Gist options
  • Save allanphilipbarku/16907aed6efe89635667f9ccf572cfeb to your computer and use it in GitHub Desktop.
Save allanphilipbarku/16907aed6efe89635667f9ccf572cfeb to your computer and use it in GitHub Desktop.
const actions = new Map([
['guest_1', ()=>{/*do sth*/}],
['guest_2', ()=>{/*do sth*/}],
['guest_3', ()=>{/*do sth*/}],
['guest_4', ()=>{/*do sth*/}],
['guest_5', ()=>{/*do sth*/}],
['master_1', ()=>{/*do sth*/}],
['master_2', ()=>{/*do sth*/}],
['master_3', ()=>{/*do sth*/}],
['master_4', ()=>{/*do sth*/}],
['master_5', ()=>{/*do sth*/}],
['default', ()=>{/*do sth*/}],
])
const onButtonClick = (identity,status)=>{
let action = actions.get(`${identity}_${status}`) || actions.get('default')
action.call(this)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment