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

    0.8.1 • 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

    // Type definitions for konami-code-js 0.8
    // Project: https://github.com/Haeresis/konami-code-js#readme
    // Definitions by: Josh Goldberg <https://github.com/JoshuaKGoldberg>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    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: Thu, 08 Jul 2021 16:23:27 GMT
    • Dependencies: none
    • Global values: none

    Credits

    These definitions were written by Josh Goldberg.

    Keywords

    none

    Install

    npm i @types/konami-code-js

    DownloadsWeekly Downloads

    18

    Version

    0.8.1

    License

    MIT

    Unpacked Size

    7.47 kB

    Total Files

    4

    Last publish

    Collaborators

    • types