Skip to content

rkrupinski/easter.js

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

easter.js

Easter eggs made easy.

Build Status Built with Grunt

Ever wanted to make the KONAMI code work on your website?

var konamiCode = 'up up down down left right left right b a';

var deregister = easter().register(konamiCode, function() {
	// do fancy stuff

	// deregister sequence
	deregister();
});

Installation

bower install easter.js

Docs

Supported sequence formats:

  • ['a', 'b', 'c'] *
  • [65, 66, 67]
  • ['a', 66, 'c'] *
  • 'a b c' *

* - When using strings, you're limited to:

  • a-z
  • 0-9
  • left, right, up, down, shift, ctrl, alt, space

Sequence can be deregistered by calling function returned by register() call.

Default configuration can be altered as it is exposed via easter.defaults. Available configuration options are:

  • sequenceMax: maximum length of registered sequence (default: 20)
  • delay: maximum delay between keystrokes in ms (default: 500)

Using standalone:

easter().register(sequence, callback);

Using with RequireJS:

require(['easter'], function (easter) {
	easter().register(sequence, callback);
});

Using with browserify:

var easter = require('./easter.js');

easter().register(sequence, callback);

Browser support

IE9+