goog.net.IframeIo
Classgoog.net.IframeIo
> goog.events.EventTarget
> goog.Disposable
goog.net.IframeIo()
Class for managing requests via iFrames.
.FRAME_NAME_PREFIX
{string
}Prefix for frame names
.IFRAME_DISPOSE_DELAY_MS
{number
}The number of milliseconds after a request is completed to dispose the iframes. This can be done lazily so we wait long enough for any processing that occurred as a result of the response to finish.
.INNER_FRAME_SUFFIX
{string
}Suffix that is added to inner frames used for sending requests in non-IE browsers
goog.net.IframeIo.IncrementalDataEvent
ClassClass for representing incremental data events. … more
.abort(opt_failureCode)
Abort the current Iframe request
opt_failureCode
{goog.net.ErrorCode
=}
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass };
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getErrorChecker()
Gets the callback function used to check if a loaded IFrame is in an error state.
Function
}
.getIframeByName(fname)
Find an iframe by name (assumes the context is goog.global since that is where IframeIo's iframes are kept).
fname
{string
}
HTMLIFrameElement
}
.getInstanceByName(fname)
Find an instance of the IframeIo object by name.
fname
{string
}
goog.net.IframeIo
}
.getLastCustomError()
Gets the last custom error.
Object
}
.getLastError()
Gets the last error message.
string
}
.getLastErrorCode()
Gets the last error code.
goog.net.ErrorCode
}
.getLastUri()
Get the uri of the last request.
goog.Uri
}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getResponseHtml()
Returns the last response html (i.e. the innerHtml of the iframe).
string
}
.getResponseJson()
Parses the content as JSON. This is a safe parse and may throw an error if the response is malformed. Use goog.json.unsafeparse(this.getResponseText()) if you are sure of the state of the returned content.
Object
}
.getResponseText()
Returns the last response text (i.e. the text content of the iframe). Assumes plain text!
string
}
.getResponseXml()
Returns the document object from the last request. Not truely XML, but used to mirror the XhrIo interface.
HTMLDocument
}
.getTimeoutInterval()
Returns the number of milliseconds after which an incomplete request will be aborted, or 0 if no timeout is set.
number
}
.handleIncrementalData(win, data)
Handles incremental data and routes it to the correct iframeIo instance. The HTML page requested by the IframeIo instance should contain script blocks that call an externed reference to this method.
win
{Window
}
data
{Object
}
.isActive()
boolean
}
.isComplete()
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isSuccess()
boolean
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.send(uri, opt_callback, opt_method, opt_noCache, opt_data)
Static send that creates a short lived instance of IframeIo to send the request.
uri
{goog.Uri
|string
}
opt_callback
{Function
=}
opt_method
{string
=}
opt_noCache
{boolean
=}
opt_data
{Object
|goog.structs.Map
=}
.sendFromForm(form, opt_uri, opt_noCache)
Sends the data stored in an existing form to the server. The HTTP method should be specified on the form, the action can also be specified but can be overridden by the optional URI param. This can be used in conjunction will a file-upload input to upload a file in the background without affecting history. Example form:
<form action="/server/" enctype="multipart/form-data" method="POST"> <input name="userfile" type="file"> </form>
form
{HTMLFormElement
}
opt_uri
{string
=}
opt_noCache
{boolean
=}
.setErrorChecker(fn)
Sets the callback function used to check if a loaded IFrame is in an error state.
fn
{Function
}
.setParentEventTarget(parent)
Inherited from goog.events.EventTarget
.
Sets the parent of this event target to use for bubbling.
parent
{goog.events.EventTarget
?}
.setTimeoutInterval(ms)
Sets the number of milliseconds after which an incomplete request will be aborted and a {@link goog.net.EventType.TIMEOUT} event raised; 0 means no timeout is set.
ms
{number
}