npm

@types/konami-code-js
TypeScript icon, indicating that this package has built-in type declarations

0.8.3 • Public • Published

Installation

npm install --save @types/konami-code-js

Summary

This package contains type definitions for konami-code-js (https://github.com/Haeresis/konami-code-js#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/konami-code-js.

index.d.ts

interface KonamiOptions {
    /**
     * Function executed after the the Konami Code sequence has been entered.
     */
    callback?: KonamiCallback | undefined;

    /**
     * When true, allows you to see all debug messages in the console.
     *
     * @default false
     */
    debug?: boolean | undefined;

    /**
     * Pass some element to only recognize the Konami Code sequence from thatt element.
     *
     * @default window.document
     */
    listener?: Node | undefined;
}

type KonamiCallback = (instance: KonamiCode) => void;

declare class KonamiCode {
    constructor(options: KonamiCallback | KonamiOptions);

    /**
     * Activate the listening of the Konami Code sequence.
     */
    enable(): KonamiCode;

    /**
     * Activate the listening of the Konami Code sequence for keyboard keys.
     */
    enableKeyboardKeys(): KonamiCode;

    /**
     * Activate the listening of the Konami Code sequence for touch gestures.
     */
    enableTouchGesture(): KonamiCode;

    /**
     * Unactivate the listening of the Konami Code sequence.
     */
    disable(): KonamiCode;

    /**
     * Unactivate the listening of the Konami Code sequence for keyboard keys.
     */
    disableKeyboardKeys(): KonamiCode;

    /**
     * Unactivate the listening of the Konami Code sequence for touch gestures.
     */
    disableTouchGesture(): KonamiCode;

    /**
     * Change the callback called when the sequence fires.
     *
     * @remarks The old callback will no longer work.
     */
    setCallback(callback: KonamiCallback): KonamiCode;

    /**
     * Change the listener.
     *
     * @remarks The old listener will no longer work.
     */
    setListener(listener: Node): KonamiCode;

    /**
     * Change the options of the instance.
     */
    setOptions(options: KonamiOptions | (() => KonamiOptions)): KonamiCode;

    /**
     * If a previous KonamiCode variable already existed in the global environment,
     * this switches back to it.
     */
    static noConflict(): KonamiCode;

    /**
     * @returns The number of times KonamiCode was instantiated.
     */
    static getNumberOfInstance(): number;
}

export = KonamiCode;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:38 GMT
  • Dependencies: none

Credits

These definitions were written by Josh Goldberg.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/konami-code-js

Weekly Downloads

639

Version

0.8.3

License

MIT

Unpacked Size

6.96 kB

Total Files

5

Last publish

Collaborators

  • types