Last active
April 19, 2019 22:52
-
-
Save SgtPooki/1fde0a575b23d7e97c5c6135905d2a5b to your computer and use it in GitHub Desktop.
MyElement
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
MyElement | |
Hover | |
HStill | |
HMoving | |
onMouseOut -> MouseOutside | |
onMouseMove -> HMoving | |
onMouseStop -> HStill | |
MouseOutside* | |
onMouseEnter -> HMoving |
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
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