Sha256: e78b8ce0016c8de1cae04c45deb642674b7eb9ee69e3f21d746438dacd28e3f6

Contents?: true

Size: 639 Bytes

Versions: 29

Compression:

Stored size: 639 Bytes

Contents

'use strict';

var Event = require('./event');

var EventTarget = {
  onopen:     null,
  onmessage:  null,
  onerror:    null,
  onclose:    null,

  addEventListener: function(eventType, listener, useCapture) {
    this.on(eventType, listener);
  },

  removeEventListener: function(eventType, listener, useCapture) {
    this.removeListener(eventType, listener);
  },

  dispatchEvent: function(event) {
    event.target = event.currentTarget = this;
    event.eventPhase = Event.AT_TARGET;

    if (this['on' + event.type])
      this['on' + event.type](event);

    this.emit(event.type, event);
  }
};

module.exports = EventTarget;

Version data entries

29 entries across 28 versions & 9 rubygems

Version Path
ilog-0.4.0 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
ilog-0.3.3 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
jester-data-8.0.0 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
ezii-os-5.2.1 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
ezii-os-2.0.1 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
ezii-os-1.1.0 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
ezii-os-1.0.0 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
ezii-os-0.0.0.1.0 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
ezii-os-0.0.0.0.1 node_modules/sockjs-client/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js