source: trip-planner-front/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 639 bytes
Line 
1'use strict';
2
3var Event = require('./event');
4
5var EventTarget = {
6 onopen: null,
7 onmessage: null,
8 onerror: null,
9 onclose: null,
10
11 addEventListener: function(eventType, listener, useCapture) {
12 this.on(eventType, listener);
13 },
14
15 removeEventListener: function(eventType, listener, useCapture) {
16 this.removeListener(eventType, listener);
17 },
18
19 dispatchEvent: function(event) {
20 event.target = event.currentTarget = this;
21 event.eventPhase = Event.AT_TARGET;
22
23 if (this['on' + event.type])
24 this['on' + event.type](event);
25
26 this.emit(event.type, event);
27 }
28};
29
30module.exports = EventTarget;
Note: See TracBrowser for help on using the repository browser.