Skip to content

Small Javascript library to call functions when the user enters the Konami Code.

License

Notifications You must be signed in to change notification settings

sidp/konami-code

Repository files navigation

konami-code

Build status

This is a small Javascript library to call functions when the user enters the Konami Code.

↑ ↑ ↓ ↓ ← → ← → B A

Usage

Install the package from npm:

npm install @sidp/konami-code

Import the package into your project. Add a function by passing it as an argument to the konamiCode function.

import konamiCode from '@sidp/konami-code';

konamiCode(() => {
  /* do stuff */
});

If you want to remove the listener, call the remove() function on the returned object, or on this in the callback function:

const kc = konamiCode(() => {
  /* do stuff */
});
kc.remove();

// - or -

konamiCode(function() {
  /* do stuff */
  this.remove();
});

Browser support

This library supports all modern browsers, including Internet Explorer 9 and better.

About

Small Javascript library to call functions when the user enters the Konami Code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published