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

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

Constant Summary collapse

CAPTURING_PHASE =
1
AT_TARGET =
2
BUBBLING_PHASE =
3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_type, options = {}) ⇒ Event

Returns a new instance of Event.



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

def initialize(event_type, options = {})
  @type = event_type
  metaclass = (class << self ; self ; end)
  options.each do |key, value|
    metaclass.__send__(:define_method, key) { value }
  end
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

#dataObject

Returns the value of attribute data.



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

def data
  @data
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

Instance Method Details

#init_event(event_type, can_bubble, cancelable) ⇒ Object



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

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

#prevent_defaultObject



28
29
# File 'lib/faye/websocket/api/event.rb', line 28

def prevent_default
end

#stop_propagationObject



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

def stop_propagation
end