electrum-events
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -62,2 +62,9 @@ 'use strict'; | ||
}, { | ||
key: 'handleBlur', | ||
value: function handleBlur(ev) { | ||
this.notify(ev, e => this.forwardNotifyEvent(e, 'defocus')); | ||
this.notify(ev, e => this.forwardDispatchEvent(e, 'defocus')); | ||
ev.stopPropagation(); | ||
} | ||
}, { | ||
key: 'handleFocus', | ||
@@ -171,2 +178,3 @@ value: function handleFocus(ev) { | ||
const existingOnBlur = obj.onBlur; | ||
const existingOnFocus = obj.onFocus; | ||
@@ -180,2 +188,8 @@ const existingOnChange = obj.onChange; | ||
obj.onBlur = e => { | ||
/* jshint expr: true */ | ||
existingOnBlur && existingOnBlur.call(obj, e); | ||
eh.handleBlur(e); | ||
}; | ||
obj.onFocus = e => { | ||
@@ -186,2 +200,3 @@ /* jshint expr: true */ | ||
}; | ||
obj.onClick = e => { | ||
@@ -192,2 +207,3 @@ /* jshint expr: true */ | ||
}; | ||
obj.onChange = e => { | ||
@@ -198,2 +214,3 @@ /* jshint expr: true */ | ||
}; | ||
obj.onKeyDown = e => { | ||
@@ -204,2 +221,3 @@ /* jshint expr: true */ | ||
}; | ||
obj.onKeyUp = e => { | ||
@@ -210,2 +228,3 @@ /* jshint expr: true */ | ||
}; | ||
obj.onKeyPress = e => { | ||
@@ -216,2 +235,3 @@ /* jshint expr: true */ | ||
}; | ||
obj.onSelect = e => { | ||
@@ -218,0 +238,0 @@ /* jshint expr: true */ |
{ | ||
"name": "electrum-events", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Electrum Events forwards web component events to the bus.", | ||
@@ -32,2 +32,3 @@ "main": "lib/index.js", | ||
"babel-env": "^1.2.2", | ||
"generic-js-env": "^1.5.0", | ||
"mai-chai": "^2.6.0", | ||
@@ -34,0 +35,0 @@ "react": "^15.0.2", |
@@ -12,3 +12,3 @@ # Electrum Events | ||
* `handleFocus` | ||
* `handleBlur` and `handleFocus` | ||
* `handleChange` | ||
@@ -22,3 +22,3 @@ * `handleKeyDown`, `handleKeyUp` and `handleKeyPress` | ||
They are sent with the `bus.notify()` function. | ||
* Events which trigger an action (focus, button click). | ||
* Events which trigger an action (focus, defocus, button click). | ||
They are sent with the `bus.dispatch()` function. | ||
@@ -25,0 +25,0 @@ |
@@ -65,2 +65,8 @@ 'use strict'; | ||
handleBlur (ev) { | ||
this.notify (ev, e => this.forwardNotifyEvent (e, 'defocus')); | ||
this.notify (ev, e => this.forwardDispatchEvent (e, 'defocus')); | ||
ev.stopPropagation (); | ||
} | ||
handleFocus (ev) { | ||
@@ -104,2 +110,3 @@ this.notify (ev, e => this.forwardNotifyEvent (e, 'focus')); | ||
const existingOnBlur = obj.onBlur; | ||
const existingOnFocus = obj.onFocus; | ||
@@ -113,35 +120,54 @@ const existingOnChange = obj.onChange; | ||
obj.onFocus = e => { /* jshint expr: true */ | ||
existingOnFocus && existingOnFocus.call (obj, e); | ||
eh.handleFocus (e); | ||
}; | ||
obj.onClick = e => { /* jshint expr: true */ | ||
existingOnClick && existingOnClick.call (obj, e); | ||
eh.handleClick (e); | ||
}; | ||
obj.onChange = e => { /* jshint expr: true */ | ||
existingOnChange && existingOnChange.call (obj, e); | ||
eh.handleChange (e); | ||
}; | ||
obj.onKeyDown = e => { /* jshint expr: true */ | ||
existingOnKeyDown && existingOnKeyDown.call (obj, e); | ||
eh.handleKeyDown (e); | ||
}; | ||
obj.onKeyUp = e => { /* jshint expr: true */ | ||
existingOnKeyUp && existingOnKeyUp.call (obj, e); | ||
eh.handleKeyUp (e); | ||
}; | ||
obj.onKeyPress = e => { /* jshint expr: true */ | ||
existingOnKeyPress && existingOnKeyPress.call (obj, e); | ||
eh.handleKeyPress (e); | ||
}; | ||
obj.onSelect = e => { /* jshint expr: true */ | ||
existingOnSelect && existingOnSelect.call (obj, e); | ||
eh.handleSelect (e); | ||
}; | ||
obj.onBlur = | ||
e => { /* jshint expr: true */ | ||
existingOnBlur && existingOnBlur.call (obj, e); | ||
eh.handleBlur (e); | ||
}; | ||
obj.onFocus = | ||
e => { /* jshint expr: true */ | ||
existingOnFocus && existingOnFocus.call (obj, e); | ||
eh.handleFocus (e); | ||
}; | ||
obj.onClick = | ||
e => { /* jshint expr: true */ | ||
existingOnClick && existingOnClick.call (obj, e); | ||
eh.handleClick (e); | ||
}; | ||
obj.onChange = | ||
e => { /* jshint expr: true */ | ||
existingOnChange && existingOnChange.call (obj, e); | ||
eh.handleChange (e); | ||
}; | ||
obj.onKeyDown = | ||
e => { /* jshint expr: true */ | ||
existingOnKeyDown && existingOnKeyDown.call (obj, e); | ||
eh.handleKeyDown (e); | ||
}; | ||
obj.onKeyUp = | ||
e => { /* jshint expr: true */ | ||
existingOnKeyUp && existingOnKeyUp.call (obj, e); | ||
eh.handleKeyUp (e); | ||
}; | ||
obj.onKeyPress = | ||
e => { /* jshint expr: true */ | ||
existingOnKeyPress && existingOnKeyPress.call (obj, e); | ||
eh.handleKeyPress (e); | ||
}; | ||
obj.onSelect = | ||
e => { /* jshint expr: true */ | ||
existingOnSelect && existingOnSelect.call (obj, e); | ||
eh.handleSelect (e); | ||
}; | ||
return eh; | ||
} | ||
/* private methods */ | ||
/* private methods */ | ||
@@ -148,0 +174,0 @@ notify (ev, handler) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
31201
20
647
7