konami-emoji-blast
konami-emoji-blast
is a package that combines two others:
konami-code-js
: detects when the user has entered the Konami Codeβ¦emoji-blast
: β¦to startemojiBlast()
s until the code is entered again.
If a user presses up up down down left right left right b a on their keyboard or taps it on their mobile phone, emoji blasts will start firing on the page. Triggering the code again stops the blasts.
Getting Started
Dedicated integrations exist for adding konami-emoji-blast
with common frameworks:
Otherwise, this page will get you started as quickly as possible.
Quick Bundler Start
If youβre writing JavaScript or TypeScript with a bundler, first install the konami-emoji-blast
package as a dependency:
You can then import it in your code to access its initializeKonamiEmojiBlast
function:
Quick HTML Start
If youβre directly writing an .html
document, plop this π at the end of your <body>
:
That π loads konami-emoji-blast
soon after your page loads to set up the Konami Code with no configuration.
π.
You might want a little more fine-grained control over when the connection is created.
Use this π alternate script to create a global initializeKonamiEmojiBlast
function:
API
konami-emoji-blast
export a single function:
initializeKonamiEmojiBlast
: Initializes the Konami Code listener on the page.
initializeKonamiEmojiBlast
This will create a new konami-code-js
KonamiCode
instance to listen for user input.
It will call emojiBlasts
whenever the code is detected.
initializeKonamiEmojiBlast()
returns a cancellation function that cancels any pending work.
initializeKonamiEmojiBlast
Options
initializeKonamiEmojiBlast
may take a single optional parameter, onActivate
.
onActivate
A function to run whenever the user inputs the Konami Code.