Skip to content

Instantly share code, notes, and snippets.

@phivk
Last active August 28, 2018 22:23
Show Gist options
  • Save phivk/e8b988030f3739fddcecd2b2a9a4d7cf to your computer and use it in GitHub Desktop.
Save phivk/e8b988030f3739fddcecd2b2a9a4d7cf to your computer and use it in GitHub Desktop.
GMAB Periscope Station - Start by Looking
GMAB Periscope Station - Start by Looking
Binoculars Off*
Video Stopped
user_enter binoculars -> Binoculars On
Binoculars On
user_leave binoculars -> Binoculars Off
Video At Start*
auto_timer -> Video Playing
Video Playing
auto_timer -> Video At End
Video At End
auto_timer -> Video At Start
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