|
2 年之前 | |
---|---|---|
.. | ||
test | 2 年之前 | |
.npmignore | 2 年之前 | |
.travis.yml | 2 年之前 | |
History.md | 2 年之前 | |
LICENSE | 2 年之前 | |
Makefile | 2 年之前 | |
README.md | 2 年之前 | |
index.js | 2 年之前 | |
package.json | 2 年之前 |
CustomEvent
constructorhttps://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
$ npm install custom-event
var CustomEvent = require('custom-event');
// add an appropriate event listener
target.addEventListener('cat', function(e) { process(e.detail) });
// create and dispatch the event
var event = new CustomEvent('cat', {
detail: {
hazcheeseburger: true
}
});
target.dispatchEvent(event);