electrum-events
Advanced tools
Comparing version 0.9.0 to 1.0.0
@@ -76,4 +76,4 @@ 'use strict'; | ||
}, { | ||
key: 'handleSelect', | ||
value: function handleSelect(ev) { | ||
key: 'handleKeyPress', | ||
value: function handleKeyPress(ev) { | ||
var _this5 = this; | ||
@@ -85,7 +85,16 @@ | ||
} | ||
}, { | ||
key: 'handleSelect', | ||
value: function handleSelect(ev) { | ||
var _this6 = this; | ||
this.notify(ev, function (e) { | ||
return _this6.processChangeEvent(e); | ||
}); | ||
} | ||
}, { | ||
key: 'notify', | ||
/* private methods */ | ||
}, { | ||
key: 'notify', | ||
value: function notify(ev, handler) { | ||
@@ -124,2 +133,39 @@ if (ev.hasOwnProperty('target')) { | ||
} | ||
}], [{ | ||
key: 'inject', | ||
value: function inject(obj, props, bus) { | ||
var eh = new EventHandlers(props, bus); | ||
/* jshint expr: true */ | ||
var existingOnFocus = obj.onFocus; | ||
var existingOnChange = obj.onChange; | ||
var existingOnKeyDown = obj.onKeyDown; | ||
var existingOnKeyPress = obj.onKeyPress; | ||
var existingOnKeyUp = obj.onKeyUp; | ||
var existingOnSelect = obj.onSelect; | ||
obj.onFocus = function (e) { | ||
existingOnFocus && existingOnFocus.call(obj, e); | ||
eh.handleFocus(e); | ||
}; | ||
obj.onChange = function (e) { | ||
existingOnChange && existingOnChange.call(obj, e); | ||
eh.handleChange(e); | ||
}; | ||
obj.onKeyDown = function (e) { | ||
existingOnKeyDown && existingOnKeyDown.call(obj, e); | ||
eh.handleKeyDown(e); | ||
}; | ||
obj.onKeyUp = function (e) { | ||
existingOnKeyUp && existingOnKeyUp.call(obj, e); | ||
eh.handleKeyUp(e); | ||
}; | ||
obj.onKeyPress = function (e) { | ||
existingOnKeyPress && existingOnKeyPress.call(obj, e); | ||
eh.handleKeyPress(e); | ||
}; | ||
obj.onSelect = function (e) { | ||
existingOnSelect && existingOnSelect.call(obj, e); | ||
eh.handleSelect(e); | ||
}; | ||
} | ||
}]); | ||
@@ -126,0 +172,0 @@ |
{ | ||
"name": "electrum-events", | ||
"version": "0.9.0", | ||
"version": "1.0.0", | ||
"description": "Electrum Events forwards web component events to the bus.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -45,2 +45,6 @@ 'use strict'; | ||
handleKeyPress (ev) { | ||
this.notify (ev, e => this.processChangeEvent (e)); | ||
} | ||
handleSelect (ev) { | ||
@@ -50,2 +54,38 @@ this.notify (ev, e => this.processChangeEvent (e)); | ||
static inject (obj, props, bus) { | ||
const eh = new EventHandlers (props, bus); | ||
/* jshint expr: true */ | ||
const existingOnFocus = obj.onFocus; | ||
const existingOnChange = obj.onChange; | ||
const existingOnKeyDown = obj.onKeyDown; | ||
const existingOnKeyPress = obj.onKeyPress; | ||
const existingOnKeyUp = obj.onKeyUp; | ||
const existingOnSelect = obj.onSelect; | ||
obj.onFocus = e => { | ||
existingOnFocus && existingOnFocus.call (obj, e); | ||
eh.handleFocus (e); | ||
}; | ||
obj.onChange = e => { | ||
existingOnChange && existingOnChange.call (obj, e); | ||
eh.handleChange (e); | ||
}; | ||
obj.onKeyDown = e => { | ||
existingOnKeyDown && existingOnKeyDown.call (obj, e); | ||
eh.handleKeyDown (e); | ||
}; | ||
obj.onKeyUp = e => { | ||
existingOnKeyUp && existingOnKeyUp.call (obj, e); | ||
eh.handleKeyUp (e); | ||
}; | ||
obj.onKeyPress = e => { | ||
existingOnKeyPress && existingOnKeyPress.call (obj, e); | ||
eh.handleKeyPress (e); | ||
}; | ||
obj.onSelect = e => { | ||
existingOnSelect && existingOnSelect.call (obj, e); | ||
eh.handleSelect (e); | ||
}; | ||
} | ||
/* private methods */ | ||
@@ -52,0 +92,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
20385
392
0