0.2.2 • Published 7 years ago

keyboardevents-areequal v0.2.2

Weekly downloads
32,461
License
MIT
Repository
github
Last release
7 years ago

keyboardevents-areequal

Travis Build Status NPM downloads

Check if two keyboardevents objects are equals.

This module is part of an ongoing effort to make electron-localshortcut less error prone, using keyboard DOM listener instead of 'globalShortcut' method to trigger shortcuts handlers.

Usage

This example check if various KeyboardEvent objects represents the same event:

const areEqual = require('keyboardevents-areequal');

console.log(areEqual({ctrlKey: true, code: 'f'}, {ctrlKey: true, code: 'f'}));
// true

console.log(areEqual({code: 'f'}, {ctrlKey: true, code: 'f'}));
// false

API

Install

With npm installed, run

npm install --save keyboardevents-areequal

See Also

License

MIT