twister-react/jsx/common/EventListenerMixin.js
2015-05-17 19:08:10 +02:00

12 lines
302 B
JavaScript
Executable File

module.exports = EventListenerMixin = function (eventtype) {
return {
componentDidMount: function() {
window.addEventListener(eventtype, this["on"+eventtype]);
},
componentWillUnmount: function() {
window.removeEventListener(eventtype, this["on"+eventtype]);
}
}
}