Skip to content
Easter eggs made easy
JavaScript TypeScript
Find file
Latest commit 5c515a8 @rkrupinski 0.0.9
Failed to load latest commit information.
dist 0.0.9
src ts
test Updated tests to play nice with bumbed deps
.gitattributes first
.gitignore Bring back dist to version control
.travis.yml Removed 0.8
Gruntfile.js ts
README.md updated README.md
bower.json 0.0.9
karma.conf.js ts
package.json 0.0.9

README.md

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+

Something went wrong with that request. Please try again.