Trigger a callback function on anything with a sequence of key presses.
# requires react@>=16 yarn add react-konamikeyimport * as React from 'react' import Konami from 'react-konamikey' // const Konami = require('react-konamikey').default<Konami element={({ refFn }) => ( <input type="text" placeholder="gamma" ref={refFn} /> )} payload={() => console.log('KONAMI!!!')} sequence={['g', 'a', 'm', 'm', 'a']} /><Konami element={document} payload={() => console.log('KONAMI!!!')} sequence={['a', 'b', 'c']} > <div>hello world</div> </Konami>https://codesandbox.io/s/blissful-pare-c7hvb
Type: HTMLElement | Function
An HTMLElement, document, or function to attach keydown event handlers to.
Type: Function
A payload function to execute, once the Konami sequence has been fulfilled.
Type: Array [required]
An array of strings representing key names.
MIT