Class: Rednode::EventEmitter

Inherits:
Object
  • Object
show all
Defined in:
lib/rednode/events.rb

Direct Known Subclasses

Process

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_eventsObject

Returns the value of attribute _events.



3
4
5
# File 'lib/rednode/events.rb', line 3

def _events
  @_events
end

Instance Method Details

#emit(e, *args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rednode/events.rb', line 5

def emit(e, *args)
  return unless @_events
  case notify = @_events[e]
  when V8::Function
    notify.methodcall(self, *args)
  when V8::Array
    notify.each {|listener| listener.methodcall(self, *args) if listener}
  else
    return false
  end
  return true
end