class Fzeet::Windows::HTMLWindow6
Attributes
handlers[R]
Public Instance Methods
on(event, &block)
click to toggle source
# File lib/fzeet/windows/mshtml/Common.rb, line 393 def on(event, &block) ((@handlers ||= {})[event] ||= []) << block @dcallbacks ||= [] send("put_on#{event}", VARIANT.new.tap { |v| v[:vt] = VT_DISPATCH v[:pdispVal] = @dcallbacks.push(DCallback.new.tap { |dcb| dcb.instance_variable_set(:@window, self) dcb.instance_variable_set(:@event, event) def dcb.Invoke(*args) @window.handlers[@event].each { |handler| (handler.arity == 0) ? handler.call : handler.call(*args) } S_OK end }).last }) unless @handlers[event].length > 1 self end