@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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.8.3550ts5.7
0.8.3550ts5.6
0.8.3550latest
0.8.3550ts4.5
0.8.3550ts4.6
0.8.3550ts4.7
0.8.3550ts4.8
0.8.3550ts4.9
0.8.3550ts5.0
0.8.3550ts5.1
0.8.3550ts5.2
0.8.3550ts5.3
0.8.3550ts5.4
0.8.3550ts5.5
0.8.3550ts5.8
0.8.024ts3.5
0.8.13ts3.6
0.8.13ts3.7
0.8.13ts3.8
0.8.13ts3.9
0.8.13ts4.0
0.8.13ts4.1
0.8.13ts4.2
0.8.13ts4.3
0.8.13ts4.4

Version History

VersionDownloads (Last 7 Days)Published
0.8.3550
0.8.20
0.8.13
0.8.024

Package Sidebar

Install

npm i @types/konami-code-js

Weekly Downloads

577

Version

0.8.3

License

MIT

Unpacked Size

6.96 kB

Total Files

5

Last publish

Collaborators

  • types