Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7: Reactive Extensions for JavaS... > Example: Using jQuery DOM Events to ...

Example: Using jQuery DOM Events to Detect a Konami Code

People who grew up playing a lot of video games in the '80s and '90s will have fond memories of the Konami Code (see http://en.wikipedia.org/wiki/Konami_Code). This cheat code was found in many games written by Konami, and usually gave the player “extra lives” or some other bonus to the game.

Several web sites, such as Facebook and Marvel Comics, have added this code in at various times in their history as April Fools' Day pranks or for other events, enabling some often silly feature until the next page refresh.

Implementing the Konami Code Easter egg using pure JavaScript can be pretty daunting, but with RxJS, it's fairly easy to detect the Konami Code pattern in the event stream using the Buffer operator. The following is the HTML. Paste it into a file called KonamiCode.html:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint