Class: Hyalite::SyntheticEvent
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Instance Method Summary collapse
- #add_listener(listener, target_id) ⇒ Object
- #each_listener(&block) ⇒ Object
-
#initialize(event) ⇒ SyntheticEvent
constructor
A new instance of SyntheticEvent.
Constructor Details
#initialize(event) ⇒ SyntheticEvent
Returns a new instance of SyntheticEvent.
5 6 7 8 |
# File 'lib/hyalite/synthetic_event.rb', line 5 def initialize(event) @event = event @listeners = [] end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
3 4 5 |
# File 'lib/hyalite/synthetic_event.rb', line 3 def event @event end |
Instance Method Details
#add_listener(listener, target_id) ⇒ Object
10 11 12 |
# File 'lib/hyalite/synthetic_event.rb', line 10 def add_listener(listener, target_id) @listeners << [listener, target_id] end |
#each_listener(&block) ⇒ Object
14 15 16 |
# File 'lib/hyalite/synthetic_event.rb', line 14 def each_listener(&block) @listeners.each {|listener| yield(listener) } end |