Class: Fzeet::Windows::HTMLXMLHttpRequest
- Inherits:
-
Object
- Object
- Fzeet::Windows::HTMLXMLHttpRequest
- 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.
448 449 450 |
# File 'lib/fzeet/windows/mshtml/Common.rb', line 448 def handlers @handlers end |
Instance Method Details
#old_open ⇒ Object
504 |
# File 'lib/fzeet/windows/mshtml/Common.rb', line 504 alias old_open open |
#on(event, &block) ⇒ Object
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/fzeet/windows/mshtml/Common.rb', line 450 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(:@request, self) dcb.instance_variable_set(:@event, event) def dcb.Invoke(*args) @request.handlers[@event].each { |handler| (handler.arity == 0) ? handler.call : handler.call(*args) } S_OK end }).last }) unless @handlers[event].length > 1 self end |
#open(url, method = 'get') ⇒ Object
506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/fzeet/windows/mshtml/Common.rb', line 506 def open(url, method = 'get') old_open( bstr = Windows.SysAllocString("#{method}\0".encode('utf-16le')), bstr2 = Windows.SysAllocString("#{url}\0".encode('utf-16le')), VARIANT.new.tap { |v| v[:vt] = VT_BOOL; v[:boolVal] = -1 }, VARIANT.new, VARIANT.new ) self ensure Windows.SysFreeString(bstr) Windows.SysFreeString(bstr2) end |