electrum-events
Advanced tools
Comparing version 1.1.2 to 1.2.0
'use strict'; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -31,3 +31,3 @@ Object.defineProperty(exports, "__esModule", { | ||
var EventHandlers = (function () { | ||
var EventHandlers = function () { | ||
function EventHandlers(obj, bus) { | ||
@@ -65,11 +65,21 @@ _classCallCheck(this, EventHandlers); | ||
}, { | ||
key: 'handleClick', | ||
value: function handleClick(ev) { | ||
var _this = this; | ||
this.notify(ev, function (e) { | ||
return _this.forwardDispatchEvent(e, 'action'); | ||
}); | ||
ev.stopPropagation(); | ||
} | ||
}, { | ||
key: 'handleFocus', | ||
value: function handleFocus(ev) { | ||
var _this = this; | ||
var _this2 = this; | ||
this.notify(ev, function (e) { | ||
return _this.processChangeEvent(e, 'focus'); | ||
return _this2.forwardNotifyEvent(e, 'focus'); | ||
}); | ||
this.notify(ev, function (e) { | ||
return _this.processFocusEvent(e, 'focus'); | ||
return _this2.forwardDispatchEvent(e, 'focus'); | ||
}); | ||
@@ -81,6 +91,6 @@ ev.stopPropagation(); | ||
value: function handleChange(ev) { | ||
var _this2 = this; | ||
var _this3 = this; | ||
this.notify(ev, function (e) { | ||
return _this2.processChangeEvent(e, 'change'); | ||
return _this3.forwardNotifyEvent(e, 'change'); | ||
}); | ||
@@ -93,6 +103,6 @@ ev.stopPropagation(); | ||
value: function handleKeyDown(ev) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
this.notify(ev, function (e) { | ||
return _this3.processChangeEvent(e, 'key-down'); | ||
return _this4.forwardNotifyEvent(e, 'key-down'); | ||
}); | ||
@@ -103,6 +113,6 @@ } | ||
value: function handleKeyUp(ev) { | ||
var _this4 = this; | ||
var _this5 = this; | ||
this.notify(ev, function (e) { | ||
return _this4.processChangeEvent(e, 'key-up'); | ||
return _this5.forwardNotifyEvent(e, 'key-up'); | ||
}); | ||
@@ -113,6 +123,6 @@ } | ||
value: function handleKeyPress(ev) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
this.notify(ev, function (e) { | ||
return _this5.processChangeEvent(e, 'key-press'); | ||
return _this6.forwardNotifyEvent(e, 'key-press'); | ||
}); | ||
@@ -123,6 +133,6 @@ } | ||
value: function handleSelect(ev) { | ||
var _this6 = this; | ||
var _this7 = this; | ||
this.notify(ev, function (e) { | ||
return _this6.processChangeEvent(e, 'select'); | ||
return _this7.forwardNotifyEvent(e, 'select'); | ||
}); | ||
@@ -141,4 +151,4 @@ } | ||
}, { | ||
key: 'processChangeEvent', | ||
value: function processChangeEvent(ev, source) { | ||
key: 'forwardNotifyEvent', | ||
value: function forwardNotifyEvent(ev, source) { | ||
this.log(ev, source); | ||
@@ -152,8 +162,8 @@ var bus = this.bus; | ||
}, { | ||
key: 'processFocusEvent', | ||
value: function processFocusEvent(ev, source) { | ||
key: 'forwardDispatchEvent', | ||
value: function forwardDispatchEvent(ev, source) { | ||
this.log(ev, source); | ||
var bus = this.bus; | ||
if (bus && 'dispatch' in bus) { | ||
bus.dispatch(this.props, 'focus'); | ||
bus.dispatch(this.props, source); | ||
} | ||
@@ -217,2 +227,3 @@ } | ||
var existingOnSelect = obj.onSelect; | ||
var existingOnClick = obj.onClick; | ||
@@ -224,2 +235,7 @@ obj.onFocus = function (e) { | ||
}; | ||
obj.onClick = function (e) { | ||
/* jshint expr: true */ | ||
existingOnClick && existingOnClick.call(obj, e); | ||
eh.handleClick(e); | ||
}; | ||
obj.onChange = function (e) { | ||
@@ -256,3 +272,3 @@ /* jshint expr: true */ | ||
return EventHandlers; | ||
})(); | ||
}(); | ||
@@ -259,0 +275,0 @@ /******************************************************************************/ |
{ | ||
"name": "electrum-events", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Electrum Events forwards web component events to the bus.", | ||
@@ -25,7 +25,7 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"electrum-utils": "^1.0.0" | ||
"electrum-utils": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.3.15", | ||
"babel-core": "^6.3.15", | ||
"babel-cli": "^6.4.5", | ||
"babel-core": "^6.4.5", | ||
"babel-preset-es2015": "^6.3.13", | ||
@@ -35,9 +35,9 @@ "babel-preset-react": "^6.3.13", | ||
"chai": "^3.4.1", | ||
"jsdom": "^7.2.0", | ||
"jsdom": "^7.2.2", | ||
"mai-chai": "^1.1.2", | ||
"mocha": "^2.3.4", | ||
"mocha": "^2.4.2", | ||
"path": "^0.12.7", | ||
"react": "^0.14.3", | ||
"react-dom": "^0.14.3" | ||
"react": "^0.14.6", | ||
"react-dom": "^0.14.6" | ||
} | ||
} |
@@ -59,5 +59,11 @@ 'use strict'; | ||
handleClick (ev) { | ||
this.notify (ev, e => this.forwardDispatchEvent (e, 'action')); | ||
ev.stopPropagation (); | ||
} | ||
handleFocus (ev) { | ||
this.notify (ev, e => this.processChangeEvent (e, 'focus')); | ||
this.notify (ev, e => this.processFocusEvent (e, 'focus')); | ||
this.notify (ev, e => this.forwardNotifyEvent (e, 'focus')); | ||
this.notify (ev, e => this.forwardDispatchEvent (e, 'focus')); | ||
ev.stopPropagation (); | ||
@@ -67,3 +73,3 @@ } | ||
handleChange (ev) { | ||
this.notify (ev, e => this.processChangeEvent (e, 'change')); | ||
this.notify (ev, e => this.forwardNotifyEvent (e, 'change')); | ||
ev.stopPropagation (); | ||
@@ -74,15 +80,15 @@ ev.preventDefault (); | ||
handleKeyDown (ev) { | ||
this.notify (ev, e => this.processChangeEvent (e, 'key-down')); | ||
this.notify (ev, e => this.forwardNotifyEvent (e, 'key-down')); | ||
} | ||
handleKeyUp (ev) { | ||
this.notify (ev, e => this.processChangeEvent (e, 'key-up')); | ||
this.notify (ev, e => this.forwardNotifyEvent (e, 'key-up')); | ||
} | ||
handleKeyPress (ev) { | ||
this.notify (ev, e => this.processChangeEvent (e, 'key-press')); | ||
this.notify (ev, e => this.forwardNotifyEvent (e, 'key-press')); | ||
} | ||
handleSelect (ev) { | ||
this.notify (ev, e => this.processChangeEvent (e, 'select')); | ||
this.notify (ev, e => this.forwardNotifyEvent (e, 'select')); | ||
} | ||
@@ -106,2 +112,3 @@ | ||
const existingOnSelect = obj.onSelect; | ||
const existingOnClick = obj.onClick; | ||
@@ -112,2 +119,6 @@ obj.onFocus = e => { /* jshint expr: true */ | ||
}; | ||
obj.onClick = e => { /* jshint expr: true */ | ||
existingOnClick && existingOnClick.call (obj, e); | ||
eh.handleClick (e); | ||
}; | ||
obj.onChange = e => { /* jshint expr: true */ | ||
@@ -145,3 +156,3 @@ existingOnChange && existingOnChange.call (obj, e); | ||
processChangeEvent (ev, source) { | ||
forwardNotifyEvent (ev, source) { | ||
this.log (ev, source); | ||
@@ -155,7 +166,7 @@ const bus = this.bus; | ||
processFocusEvent (ev, source) { | ||
forwardDispatchEvent (ev, source) { | ||
this.log (ev, source); | ||
const bus = this.bus; | ||
if (bus && 'dispatch' in bus) { | ||
bus.dispatch (this.props, 'focus'); | ||
bus.dispatch (this.props, source); | ||
} | ||
@@ -162,0 +173,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
30079
635
Updatedelectrum-utils@^1.1.0