UNPKG

konami-emoji-blast

Version:

Hooks up konami-code-js to trigger emoji-blast. 🎇

35 lines (34 loc) 1.31 kB
import { type EmojiBlastsSettings } from "emoji-blast"; export type OnKonamiCodeActivated = () => void; /** * Options bag to attach custom settings and event callbacks. */ export interface KonamiEmojiBlastOptions { /** * Triggered when the Konami code (↑ ↑ ↓ ↓ ← → ← → B A) is entered and blasting has begun. */ onKonamiCodeActivated?: OnKonamiCodeActivated; /** * Settings for the resulting emoji blasts, such as emoji choice, * physics, and frequency. * * Proxies {@link EmojiBlastsSettings} */ emojiBlastSettings?: Partial<EmojiBlastsSettings>; } /** * Initializes the Konami code listener to trigger emoji blasts. * @param optionsOrOnActivated Either a callback triggered on activation, * or full options bag. * @returns A cleanup function to disable the listener and cancel active explosions. * @example * // callback * const stop = initializeKonamiEmojiBlast(() => console.log("Activated!")); * * // options bag * const stop = initializeKonamiEmojiBlast({ * onKonamiCodeActivated: () => console.log("Activated!"), * emojiBlastSettings: { emojis: ["🐙", "✨"] } * }); */ export declare const initializeKonamiEmojiBlast: (optionsOrOnActivated?: OnKonamiCodeActivated | Partial<KonamiEmojiBlastOptions>) => () => void;