Skip to content

Instantly share code, notes, and snippets.

@marionebl
Last active January 19, 2021 03:04
Show Gist options
  • Save marionebl/4ed1729e1490753a48807b6fba9ad017 to your computer and use it in GitHub Desktop.
Save marionebl/4ed1729e1490753a48807b6fba9ad017 to your computer and use it in GitHub Desktop.
Browser?
Browser?
Main Thread
Busy
complete -> Idle
Idle
block -> Busy
Worker Thread
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