Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Created December 11, 2017 09:21
Show Gist options
  • Save jooyunghan/b109c4355e95c358ae65283b7aa078e7 to your computer and use it in GitHub Desktop.
Save jooyunghan/b109c4355e95c358ae65283b7aa078e7 to your computer and use it in GitHub Desktop.
function* knockCodeHandler(preset) {
while (true) {
const input = [];
for (let i=0; i<preset.length; i++) {
input.push(getCode(yield));
}
if (input.join("") === preset) {
success();
} else {
failure();
}
}
}
element.onclick = coro(knockCodeHandler("0113"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment