Last active
August 28, 2018 22:23
-
-
Save phivk/077d4a829b1dbb83b2eddff79d431072 to your computer and use it in GitHub Desktop.
GMAB Periscope Station - Start by Pickup
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
GMAB Periscope Station - Start by Pickup | |
Headphone Down* | |
Video Stopped | |
user_pick up headphone -> Headphone Up | |
Headphone Up | |
user_put down headphone -> Headphone Down | |
Video At Start* | |
auto_timer -> Video Playing | |
Video Playing | |
auto_timer -> Video At End | |
Video At End | |
auto_timer -> Video At Start |
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
function render_video(model){ | |
let video_state = model.active_states[0]; | |
if (video_state.image_url) { | |
return $("img", | |
{ | |
src: model.active_states[0].image_url, | |
style: { | |
width: "100px", | |
margin: "1rem" | |
} | |
} | |
); | |
} | |
else { | |
return $( | |
"div", | |
{ | |
style: { | |
display: 'inline-block', | |
width: "10rem", | |
margin: '1rem', | |
} | |
}, | |
video_state.name | |
); | |
} | |
} | |
function render_headphone(model){ | |
let headphone_state = model.active_states[0].parent; | |
if (headphone_state.image_url) { | |
return $("img", | |
{ | |
src: headphone_state.image_url, | |
style: { | |
width: "100px", | |
margin: "1rem" | |
} | |
} | |
); | |
} | |
return $( | |
"div", | |
{ | |
style: { | |
display: 'inline-block', | |
width: "10rem", | |
margin: '1rem', | |
} | |
}, | |
headphone_state.name | |
); | |
} | |
function render(model){ | |
console.log(model); | |
return $("div", | |
render_video(model), | |
render_headphone(model), | |
$("br"), | |
$('button', { | |
style: { | |
display: 'inline-block', | |
width: "100px", | |
margin: '1rem', | |
}, | |
onClick: function(){ model.emit(model.active_states[0].transitions[0].event_name) } | |
}, | |
model.active_states[0].transitions ? model.active_states[0].transitions[0].event_name : "" | |
), | |
$('button', { | |
style: { | |
display: 'inline-block', | |
width: "10rem", | |
margin: '1rem', | |
}, | |
onClick: function(){ model.emit(model.active_states[0].parent.transitions[0].event_name) } | |
}, | |
model.active_states[0].parent.transitions[0].event_name | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment