class Fzeet::Windows::HTMLXMLHttpRequest

Attributes

handlers[R]

Public Instance Methods

old_open(url, method = 'get')
Alias for: open
on(event, &block) click to toggle source
# 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') click to toggle source
# 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
Also aliased as: old_open