Browse Source

use rc-util addEventListener

pull/149/head
afc163 9 years ago
parent
commit
192f150bc2
  1. 14
      components/modal/eventListener.js
  2. 4
      components/modal/index.jsx

14
components/modal/eventListener.js

@ -1,14 +0,0 @@
function wrap(standard, fallback) {
return function (el, evtName, listener, useCapture) {
if (el[standard]) {
el[standard](evtName, listener, useCapture);
} else if (el[fallback]) {
el[fallback]('on' + evtName, listener);
}
};
}
export default {
add: wrap('addEventListener', 'attachEvent'),
remove: wrap('removeEventListener', 'detachEvent')
};

4
components/modal/index.jsx

@ -1,6 +1,6 @@
import React from 'react';
import Dialog from 'rc-dialog';
import eventListener from './eventListener';
import { Dom } from 'rc-util';
function noop() {
}
@ -12,7 +12,7 @@ function onDocumentMousemove(e) {
};
}
eventListener.add(document, 'mousemove', onDocumentMousemove);
Dom.addEventListener(document, 'mousemove', onDocumentMousemove);
export default React.createClass({
getDefaultProps() {

Loading…
Cancel
Save