Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexanderson1993/react-konami-hook
A hook for reacting to the Konami Code
https://github.com/alexanderson1993/react-konami-hook
Last synced: 2 months ago
JSON representation
A hook for reacting to the Konami Code
- Host: GitHub
- URL: https://github.com/alexanderson1993/react-konami-hook
- Owner: alexanderson1993
- License: mit
- Created: 2018-11-15T16:46:01.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-16T19:53:24.000Z (almost 6 years ago)
- Last Synced: 2024-07-09T16:13:23.428Z (3 months ago)
- Language: JavaScript
- Size: 143 KB
- Stars: 63
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - react-konami-hook
README
# `React Konami Hook` 👾
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)
> React hook for adding the Konami code to your app
> **Note:** This is using the new
> [React Hooks API Proposal](https://reactjs.org/docs/hooks-intro.html) which is
> subject to change until React 16.7 final.
>
> You'll need to install `react`, `react-dom`, etc at `^16.7.0-alpha.2`[![Edit useKonami hook](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/6v25x8pyyn)
## Install
```sh
yarn add react-konami-hook
```or
```sh
npm install --save react-konami-hook
```## Usage
Just put a callback function into the hook for when the Konami Code is entered.
Simple as that!```js
import useKonami from "react-konami-hook";function App() {
useKonami(() => alert("Nice Job!"));
return (
Use the Konami Code
);
}
```Then `⬆️⬆️⬇️⬇️⬅➡⬅️➡️BA`
## Example
In the project folder:
```sh
yarn
yarn example
```or
```sh
npm install
npm run example
```## Contributors
Thanks goes to these wonderful people
([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):| [
Alex](https://ralexanderson.com)
[💻](https://github.com/alexanderson1993/react-konami-hook/commits?author=alexanderson1993 "Code") |
| :---: |This project follows the
[all-contributors](https://github.com/kentcdodds/all-contributors)
specification. Contributions of any kind welcome!