Class: Browser::Event::Target::Delegate

Inherits:
Object
  • Object
show all
Defined in:
opal/browser/event/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, name, pair) ⇒ Delegate

Returns a new instance of Delegate.



111
112
113
114
115
# File 'opal/browser/event/base.rb', line 111

def initialize(target, name, pair)
  @target = target
  @name   = name
  @pair   = pair
end

Instance Method Details

#offObject

Stop listening for the event linked to the delegate.



118
119
120
121
122
123
124
125
126
# File 'opal/browser/event/base.rb', line 118

def off
  delegate = @target.delegated[@name]
  delegate.last.delete(@pair)

  if delegate.last.empty?
    delegate.first.off
    delegate.delete(@name)
  end
end