vue-global-events
Advanced tools
Comparing version 0.0.1 to 0.0.2
/*! | ||
* vue-global-events v0.0.0 | ||
* vue-global-events v0.0.2 | ||
* (c) 2017 Damian Dulisz | ||
@@ -12,7 +12,7 @@ * Released under the MIT License. | ||
mounted: function mounted () { | ||
var this$1 = this; | ||
var this$1 = this; | ||
this._listeners = Object.create(null); | ||
this._listeners = Object.create(null); | ||
Object.keys(this.$listeners).forEach(function (event) { | ||
var handler = this$1.$listeners[event]; | ||
var handler = this$1.$listeners[event]; | ||
document.addEventListener(event, handler); | ||
@@ -19,0 +19,0 @@ this$1._listeners[event] = handler; |
/*! | ||
* vue-global-events v0.0.0 | ||
* vue-global-events v0.0.2 | ||
* (c) 2017 Damian Dulisz | ||
@@ -10,7 +10,7 @@ * Released under the MIT License. | ||
mounted: function mounted () { | ||
var this$1 = this; | ||
var this$1 = this; | ||
this._listeners = Object.create(null); | ||
this._listeners = Object.create(null); | ||
Object.keys(this.$listeners).forEach(function (event) { | ||
var handler = this$1.$listeners[event]; | ||
var handler = this$1.$listeners[event]; | ||
document.addEventListener(event, handler); | ||
@@ -17,0 +17,0 @@ this$1._listeners[event] = handler; |
/*! | ||
* vue-global-events v0.0.0 | ||
* vue-global-events v0.0.2 | ||
* (c) 2017 Damian Dulisz | ||
@@ -16,7 +16,7 @@ * Released under the MIT License. | ||
mounted: function mounted () { | ||
var this$1 = this; | ||
var this$1 = this; | ||
this._listeners = Object.create(null); | ||
this._listeners = Object.create(null); | ||
Object.keys(this.$listeners).forEach(function (event) { | ||
var handler = this$1.$listeners[event]; | ||
var handler = this$1.$listeners[event]; | ||
document.addEventListener(event, handler); | ||
@@ -23,0 +23,0 @@ this$1._listeners[event] = handler; |
/*! | ||
* vue-global-events v0.0.0 | ||
* vue-global-events v0.0.2 | ||
* (c) 2017 Damian Dulisz | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
{ | ||
"name": "vue-global-events", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Component to register global events", | ||
"main": "dist/index.js", | ||
"scripts": {}, | ||
"main": "dist/vue-global-events.cjs.js", | ||
"module": "dist/vue-global-events.es.js", | ||
"unpkg": "dist/vue-global-events.js", | ||
"browser": "dist/vue-global-events.js", | ||
"files": [ | ||
"README.md", | ||
"LICENSE", | ||
"dist/**", | ||
"src/**" | ||
], | ||
"scripts": { | ||
"test": "jest --coverage", | ||
"dev": "jest --watchAll --coverage", | ||
"lint": "eslint --color --ext=js,vue src test.js", | ||
"pretest": "npm run lint", | ||
"prepublishOnly": "npm run build", | ||
"build": "rollit" | ||
}, | ||
"repository": { | ||
@@ -16,2 +32,5 @@ "type": "git", | ||
"window", | ||
"document", | ||
"shortcuts", | ||
"anywhere", | ||
"listeners" | ||
@@ -28,3 +47,18 @@ ], | ||
}, | ||
"homepage": "https://github.com/shentao/vue-global-events#readme" | ||
"homepage": "https://github.com/shentao/vue-global-events#readme", | ||
"devDependencies": { | ||
"babel-jest": "^21.2.0", | ||
"babel-preset-env": "^1.6.1", | ||
"eslint": "^4.12.1", | ||
"eslint-config-posva": "^1.3.2", | ||
"jest": "^21.2.1", | ||
"vue": "^2.5.9", | ||
"vue-template-compiler": "^2.5.9", | ||
"vue-test-utils": "^1.0.0-beta.6" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.js$": "<rootDir>/node_modules/babel-jest" | ||
} | ||
} | ||
} |
# vue-global-events | ||
> Listen to events on the document anywhere | ||
## Installation | ||
```bash | ||
npm install vue-global-events --save | ||
npm install vue-global-events | ||
``` | ||
## Usage | ||
```javascript | ||
```js | ||
import GlobalEvents from 'vue-global-events' | ||
@@ -30,2 +33,3 @@ | ||
@keyup.space="pause" | ||
@contextmenu="openMenu" | ||
/> | ||
@@ -36,5 +40,16 @@ ``` | ||
Just use poi. | ||
Run tests in watch mode: | ||
```bash | ||
npm run dev | ||
``` | ||
## Demo | ||
Just use [poi](https://github.com/egoist/poi) | ||
```bash | ||
# if not yet installed | ||
npm i -g poi | ||
poi index.js | ||
@@ -44,4 +59,9 @@ ``` | ||
## Authors: | ||
Damian Dulisz @shentao | ||
Eduardo San Martin Morote @posva | ||
Damian Dulisz [@shentao](https://github.com/shentao) | ||
Eduardo San Martin Morote [@posva](https://github.com/posva) | ||
## License | ||
[MIT](http://opensource.org/licenses/MIT) |
export default { | ||
render: h => h(), | ||
mounted () { | ||
this._listeners = Object.create(null) | ||
this._listeners = Object.create(null) | ||
Object.keys(this.$listeners).forEach(event => { | ||
const handler = this.$listeners[event] | ||
const handler = this.$listeners[event] | ||
document.addEventListener(event, handler) | ||
@@ -8,0 +8,0 @@ this._listeners[event] = handler |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6937
65
8
8
100