Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 6ddf45d

Browse files
committed
Make Konami Code example work as expected
Load javascript files from the correct location Make code always work when an arbitrary number of keys are pressed beforehand Print the result every time the code is entered Fix typo in a comment ("konami" instead of "konmai")
1 parent 11412ce commit 6ddf45d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

examples/konamicode/konamicode.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ <h1 id="result"></h1>
2525
</div>
2626
</div>
2727
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"></script>
28-
<script src="../../rx.js"></script>
29-
<script src="../../rx.aggregates.js"></script>
30-
<script src="../../rx.binding.js"></script>
28+
<script src="../../dist/rx.js"></script>
29+
<script src="../../dist/rx.aggregates.js"></script>
30+
<script src="../../dist/rx.binding.js"></script>
3131
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs-jquery/1.1.3/rx.jquery.js"></script>
3232
<script src="konamicode.js"></script>
3333
</body>

examples/konamicode/konamicode.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ $(function () {
1616

1717
$(document).keyupAsObservable()
1818
.map(function (e) { return e.keyCode; }) // get the key code
19-
.windowWithCount(10, 10) // get the last 10 keys
20-
.selectMany(function (x) { // compare to known konmai code sequence
19+
.windowWithCount(10, 1) // get the last 10 keys
20+
.selectMany(function (x) { // compare to known konami code sequence
2121
return x.sequenceEqual(konami);
2222
})
2323
.filter(function (equal) { return equal; }) // where we match
2424
.subscribe(function () {
25-
result.html('KONAMI!').fadeOut(2000); // print the result
25+
result.html('KONAMI!').show().fadeOut(2000); // print the result
2626
});
2727
});

0 commit comments

Comments
 (0)