Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Last active December 11, 2017 09:18
Show Gist options
  • Save jooyunghan/d6d82c0f62f0b3698bddae443fc30eb9 to your computer and use it in GitHub Desktop.
Save jooyunghan/d6d82c0f62f0b3698bddae443fc30eb9 to your computer and use it in GitHub Desktop.
function makeKnockCodeHandler(preset) {
let input = [];
return function knockCodeHandler(e) {
input.push(getCode(e));
if (input.length === preset.length) {
if (input.join("") === preset) {
success();
} else {
failure();
}
input = [];
}
}
}
element.onclick = makeKnockCodeHandler("0113")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment