1.3.1 • Published 5 months ago

toukey v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Toukey

npm GitHub npm bundle size

Toukey is a simple and efficient keyboard events library. That's toukey's doc site.

Install

npm i toukey --save

or

pnpm add toukey --save

Use

Browser

You could download and link toukey.js in your HTML, It can also be downloaded via UNPKG | jsDelivr

<script src="https://unpkg.com/toukey/dist/toukey.umd.min.js"></script>
<script>
  toukey.subscribe('space', function() {
    console.log('space');
  });
</script>

React

It is easy to use with react.

import { useEffect } from "react";
import { subscribe } from "toukey";

function App() {
  useEffect(() => {
    return subscribe("scope", () => {
      console.log("scope");
    });
  });

  return <div>hello world</div>;
}

And here is a library named react-toukey-hook which build with toukey for react hook.

Basic Use

import * as Toukey from "toukey";

const handler = () => console.log("handler");

// subscribe
Toukey.on("scope", handler);

// unsubscribe
Toukey.off("scope", handler);
import { subscribe } from "toukey";

const unsubsribe = subscribe("scope", () => {
  console.log("scope");
});
1.3.1

5 months ago

1.3.0

6 months ago

1.2.6

10 months ago

1.2.4

1 year ago

1.2.0

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago