New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

makeup-key-emitter

Package Overview
Dependencies
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makeup-key-emitter - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

83

index.js

@@ -1,76 +0,77 @@

'use strict';
// requires CustomEvent polyfill for IE9+
'use strict'; // requires CustomEvent polyfill for IE
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
var CustomEvent = require('custom-event');
var util = require('./util.js');
function onKeyDownOrUp(evt, el, keyEventType) {
if (!evt.shiftKey) {
var key = util.keyCodeToKeyMap[evt.keyCode];
if (!evt.shiftKey) {
var key = util.keyCodeToKeyMap[evt.keyCode];
switch (key) {
case 'Enter':
case 'Escape':
case 'Spacebar':
case 'PageUp':
case 'PageDown':
case 'End':
case 'Home':
case 'ArrowLeft':
case 'ArrowUp':
case 'ArrowRight':
case 'ArrowDown':
el.dispatchEvent(new CustomEvent(util.uncapitalizeFirstLetter(key + 'Key' + keyEventType), {
detail: evt,
bubbles: true
}));
break;
default:
return;
}
switch (key) {
case 'Enter':
case 'Escape':
case 'Spacebar':
case 'PageUp':
case 'PageDown':
case 'End':
case 'Home':
case 'ArrowLeft':
case 'ArrowUp':
case 'ArrowRight':
case 'ArrowDown':
el.dispatchEvent(new CustomEvent(util.uncapitalizeFirstLetter("".concat(key, "Key").concat(keyEventType)), {
detail: evt,
bubbles: true
}));
break;
default:
return;
}
}
}
function onKeyDown(e) {
onKeyDownOrUp(e, this, "Down");
onKeyDownOrUp(e, this, 'Down');
}
function onKeyUp(e) {
onKeyDownOrUp(e, this, "Up");
onKeyDownOrUp(e, this, 'Up');
}
function addKeyDown(el) {
el.addEventListener('keydown', onKeyDown);
el.addEventListener('keydown', onKeyDown);
}
function addKeyUp(el) {
el.addEventListener('keyup', onKeyUp);
el.addEventListener('keyup', onKeyUp);
}
function removeKeyDown(el) {
el.removeEventListener('keydown', onKeyDown);
el.removeEventListener('keydown', onKeyDown);
}
function removeKeyUp(el) {
el.removeEventListener('keyup', onKeyUp);
el.removeEventListener('keyup', onKeyUp);
}
function add(el) {
addKeyDown(el);
addKeyUp(el);
addKeyDown(el);
addKeyUp(el);
}
function remove(el) {
removeKeyDown(el);
removeKeyUp(el);
removeKeyDown(el);
removeKeyUp(el);
}
module.exports = {
addKeyDown: addKeyDown,
addKeyUp: addKeyUp,
removeKeyDown: removeKeyDown,
removeKeyUp: removeKeyUp,
add: add,
remove: remove
addKeyDown: addKeyDown,
addKeyUp: addKeyUp,
removeKeyDown: removeKeyDown,
removeKeyUp: removeKeyUp,
add: add,
remove: remove
};
{
"name": "makeup-key-emitter",
"description": "Emits custom events for common accessibility keys (arrowRightKeyDown, escKeyDown, etc)",
"version": "0.1.0",
"version": "0.1.1",
"main": "index.js",

@@ -11,15 +11,18 @@ "repository": "https://github.com/makeup-js/makeup-key-emitter.git",

"start": "npm run build && parallelshell \"npm run server\" \"npm run watch\"",
"test": "npm run transpile && npm run lasso:test && npm run clean && karma start --autoWatch false --singleRun true",
"prepublishOnly": "npm run clean && npm run lint && npm run test && npm run build",
"build": "npm run transpile && npm run lasso",
"fix": "eslint src/index.js src/util.js --fix",
"lint": "eslint src/index.js src/util.js > lint.txt",
"lasso": "lasso require-run:./docs/index.js --out docs/static --inject-into docs/index.html --name bundle && npm run clean:lasso",
"lasso:test": "lasso require-run:./test/index.js --name bundle-test --out test/static --config ./test/lasso-config.json && npm run clean:lasso",
"clean": "rimraf reports .DS_Store test/.DS_Store src/.DS_Store docs/.DS_Store && npm run clean:lasso",
"clean:lasso": "rimraf .cache build",
"server": "browser-sync start -s --ss docs --index docs/index.html --files docs/index.html",
"watch": "onchange src/*.js docs/index.js -- npm run build",
"transpile": "babel src/index.js --out-file index.js && babel src/util.js --out-file util.js",
"version": "npm run prepublishOnly && git add -A docs/static test/static"
"test": "karma start --autoWatch false --singleRun true",
"prepublishOnly": "npm run clean && npm run lint && npm run build && npm run test && npm run transpile:module",
"prep": "npm run prepublishOnly",
"build": "npm run transpile:module && npm run build:docs",
"build:docs": "npm run transpile:docs && npm run bundle:docs",
"fix": "eslint src/index.js --fix",
"lint": "eslint src/index.js > lint.txt && eslint docs/src/index.js > lint.txt",
"clean": "npm run clean:docs && npm run clean:tests",
"clean:docs": "rimraf docs/transpiled/index.js",
"clean:tests": "rimraf lint.txt coverage",
"transpile:module": "babel src/index.js --out-file index.js",
"transpile:docs": "mkdirp docs/transpiled && babel docs/src/index.js --out-file docs/transpiled/index.js",
"bundle:docs": "webpack --config webpack.docs.js",
"server": "browser-sync start -s --ss docs --index docs/index.html --files docs/index.html docs/bundled/docs.min.js",
"watch": "onchange src/index.js docs/src/index.js -- npm run build",
"version": "npm run prepublishOnly && git add -A docs/bundled"
},

@@ -33,21 +36,29 @@ "keywords": [

"devDependencies": {
"babel-cli": "^6",
"babel-preset-env": "^1",
"@babel/cli": "^7",
"@babel/core": "^7",
"@babel/preset-env": "^7",
"@ebay/browserslist-config": "^1",
"browser-sync": "^2",
"core-js-pure": "^3",
"coveralls": "^3",
"eslint": "^4",
"eslint-config-ebay": "~0.1",
"jasmine-core": "^2",
"karma": "^1",
"karma-coverage": "^1",
"karma-html-reporter": "~0.2",
"karma-jasmine": "^1",
"karma-phantomjs-launcher": "^1",
"lasso-cli": "^2",
"onchange": "^3",
"parallelshell": "^3",
"rimraf": "^2"
"eslint": "^6",
"eslint-config-ebay": "^1",
"istanbul-instrumenter-loader": "^3",
"jasmine-core": "^3",
"karma": "^4",
"karma-chrome-launcher": "^3",
"karma-coverage": "^2",
"karma-coverage-istanbul-reporter": "^2",
"karma-jasmine": "^3",
"karma-webpack": "^4",
"mkdirp": "^1",
"nodelist-foreach-polyfill": "^1",
"onchange": "^6",
"parallelshell": "3.0.1",
"rimraf": "^3",
"webpack": "^4",
"webpack-cli": "^3"
},
"dependencies": {
"custom-event-polyfill": "^1"
"custom-event": "^1"
},

@@ -59,3 +70,6 @@ "files": [

"yarn.lock"
],
"browserslist": [
"extends @ebay/browserslist-config"
]
}

@@ -16,3 +16,3 @@ # makeup-key-emitter

This module is still in an experimental state, until it reaches v1.0.0 you must consider all minor releases as breaking changes. Patch releases may introduce new features, but will be backwards compatible.
This CommonJS module is still in an experimental state, until it reaches v1.0.0 you must consider all minor releases as breaking changes. Patch releases may introduce new features, but will be backwards compatible.

@@ -32,11 +32,11 @@ ## Install

```js
const KeyEmitter = require('makeup-key-emitter');
const KeyEmitter = require('makeup-key-emitter');
let el = document.getElementById('#widget1');
let el = document.getElementById('#widget1');
KeyEmitter.addKeyDown(el);
KeyEmitter.addKeyDown(el);
el.addEventListener('arrowRightKeyDown', function(e) {
console.log(this, e.type); // outputs (el1, 'arrowRightKeyDown')
});
el.addEventListener('arrowRightKeyDown', function(e) {
console.log(this, e.type); // outputs (el1, 'arrowRightKeyDown')
});
```

@@ -53,23 +53,6 @@

## Development
## Dependencies
* `npm start`
* `npm test`
* `npm run lint`
* `npm run fix`
* `npm run build`
* `npm run clean`
* [custom-event](https://github.com/webmodules/custom-event) (for IE)
The following hooks exist, and do not need to be invoked manually:
* `npm prepublish` cleans, lints, tests and builds on every `npm publish` command
* `pre-commit` cleans, lints, tests and builds on every `git commit` command
## Test Reports
Each test run will generate the following reports:
* `/reports/coverage` contains Istanbul code coverage report
* `/reports/html` contains HTML test report
## CI Build

@@ -76,0 +59,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc