Class: Fzeet::Windows::HTMLWindow2
- Inherits:
-
Object
- Object
- Fzeet::Windows::HTMLWindow2
- Defined in:
- lib/fzeet/windows/mshtml/Common.rb
Instance Attribute Summary collapse
-
#handlers ⇒ Object
readonly
Returns the value of attribute handlers.
Instance Method Summary collapse
Instance Attribute Details
#handlers ⇒ Object (readonly)
Returns the value of attribute handlers.
335 336 337 |
# File 'lib/fzeet/windows/mshtml/Common.rb', line 335 def handlers @handlers end |
Instance Method Details
#on(event, &block) ⇒ Object
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/fzeet/windows/mshtml/Common.rb', line 337 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 |