makeup-exit-emitter
A vanilla JavaScript port of jquery-focus-exit.
Emits custom 'focusExit' event when focus has exited an element and all of it's descendants.
Experimental
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.
Install
npm install makeup-exit-emitter
yarn add makeup-exit-emitter
Example
const ExitEmitter = require('makeup-exit-emitter');
let el = document.getElementById('#widget1');
ExitEmitter.addFocusExit(el);
el.addEventListener('focusExit', function(e){
console.log(this, e);
});
Methods
- addFocusExit
- addMouseExit
- removeFocusExit
- removeMouseExit
- add
- remove
Events
Dependencies
Development
npm start
npm test
npm run lint
npm run fix
npm run build
npm run clean
The following hooks exist, and do not need to be invoked manually:
npm prepublish
cleans, lints, tests and builds on every npm publish
commandpre-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
https://travis-ci.org/makeup-js/makeup-exit-emitter
Code Coverage
https://coveralls.io/github/makeup-js/makeup-exit-emitter