events.js 297 B

12345678910111213141516
  1. 'use strict';
  2. function raise (el, type, options) {
  3. var o = options || {};
  4. var e = document.createEvent('Event');
  5. e.initEvent(type, true, true);
  6. Object.keys(o).forEach(apply);
  7. el.dispatchEvent(e);
  8. function apply (key) {
  9. e[key] = o[key];
  10. }
  11. }
  12. module.exports = {
  13. raise: raise
  14. };