Last active
January 19, 2021 03:04
-
-
Save marionebl/4ed1729e1490753a48807b6fba9ad017 to your computer and use it in GitHub Desktop.
Browser?
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
Browser? | |
Main Thread | |
Busy | |
complete -> Idle | |
Idle | |
block -> Busy | |
Worker Thread | |
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
function render(model) { | |
mod = model; | |
const state = model.active_states[0].name; | |
const onMouseMove = () => model.emit("mousemove"); | |
const onFocus = () => model.emit("focus"); | |
const onBlur = () => model.emit("blur"); | |
const onInput = () => model.emit("type"); | |
return $("div", { onMouseMove, style: { padding: 12 }}, [ | |
$("div", { style: { display: 'flex', alignItems: 'middle', marginBottom: 20 }}, [ | |
cursor(state), | |
$("h1", { style: { margin: 0 } }, state), | |
]), | |
$("textarea", { onFocus, onBlur, onInput }), | |
]); | |
} | |
function cursor(state) { | |
switch (state) { | |
case 'Cursor': | |
return [$("img", { style: { display: "inline-block", height: 30 }, src: "https://pronto-core-cdn.prontomarketing.com/2/wp-content/uploads/sites/1256/2015/09/cursor1.png" })] | |
case 'Caret': | |
return [$("img", { style: { display: "inline-block", height: 25 }, src: "https://pronto-core-cdn.prontomarketing.com/2/wp-content/uploads/sites/1256/2015/09/cursor2.png" })]; | |
case 'Cursor and Caret': | |
return [ | |
$("img", { style: { display: "inline-block", height: 30 }, src: "https://pronto-core-cdn.prontomarketing.com/2/wp-content/uploads/sites/1256/2015/09/cursor1.png" }), | |
$("img", { style: { display: "inline-block", height: 25 }, src: "https://pronto-core-cdn.prontomarketing.com/2/wp-content/uploads/sites/1256/2015/09/cursor2.png" }) | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment