Skip to content

Instantly share code, notes, and snippets.

@SgtPooki
Last active April 19, 2019 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SgtPooki/1fde0a575b23d7e97c5c6135905d2a5b to your computer and use it in GitHub Desktop.
Save SgtPooki/1fde0a575b23d7e97c5c6135905d2a5b to your computer and use it in GitHub Desktop.
MyElement
MyElement
Hover
HStill
HMoving
onMouseOut -> MouseOutside
onMouseMove -> HMoving
onMouseStop -> HStill
MouseOutside*
onMouseEnter -> HMoving
let timer;
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{
style: {color: "darkBlue", border: '1px solid darkBlue', margin: '5px' },
className: 'foobar',
onMouseMove: () => {
model.emit('onMouseMove');
clearTimeout(timer);
timer = setTimeout(() => {
model.emit('onMouseStop');
}, 50);
},
onMouseEnter: () => {
model.emit('onMouseEnter');
},
onMouseOut: () => {
model.emit('onMouseOut');
clearTimeout(timer);
},
},
`The current state is: ${current_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment