Class: Faye::WebSocket::API::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/faye/websocket/api/event.rb

Direct Known Subclasses

CloseEvent, ErrorEvent, MessageEvent, OpenEvent

Constant Summary collapse

CAPTURING_PHASE =
1
AT_TARGET =
2
BUBBLING_PHASE =
3

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_type, options) ⇒ Event

Returns a new instance of Event.



11
12
13
14
# File 'lib/faye/websocket/api/event.rb', line 11

def initialize(event_type, options)
  @type = event_type
  options.each { |key, value| instance_variable_set("@#{ key }", value) }
end

Instance Attribute Details

#bubblesObject (readonly)

Returns the value of attribute bubbles.



4
5
6
# File 'lib/faye/websocket/api/event.rb', line 4

def bubbles
  @bubbles
end

#cancelableObject (readonly)

Returns the value of attribute cancelable.



4
5
6
# File 'lib/faye/websocket/api/event.rb', line 4

def cancelable
  @cancelable
end

#current_targetObject

Returns the value of attribute current_target.



5
6
7
# File 'lib/faye/websocket/api/event.rb', line 5

def current_target
  @current_target
end

#event_phaseObject

Returns the value of attribute event_phase.



5
6
7
# File 'lib/faye/websocket/api/event.rb', line 5

def event_phase
  @event_phase
end

#targetObject

Returns the value of attribute target.



5
6
7
# File 'lib/faye/websocket/api/event.rb', line 5

def target
  @target
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/faye/websocket/api/event.rb', line 4

def type
  @type
end

Class Method Details

.create(type, options = {}) ⇒ Object



51
52
53
# File 'lib/faye/websocket/api/event.rb', line 51

def Event.create(type, options = {})
  TYPES[type].new(type, options)
end

Instance Method Details

#init_event(event_type, can_bubble, cancelable) ⇒ Object



16
17
18
19
20
# File 'lib/faye/websocket/api/event.rb', line 16

def init_event(event_type, can_bubble, cancelable)
  @type       = event_type
  @bubbles    = can_bubble
  @cancelable = cancelable
end

#prevent_defaultObject



25
26
# File 'lib/faye/websocket/api/event.rb', line 25

def prevent_default
end

#stop_propagationObject



22
23
# File 'lib/faye/websocket/api/event.rb', line 22

def stop_propagation
end