Represents the browser.
Adds a stylesheet tag to the head.
url – {string} –
Url to css file
Adds a script tag to the head.
url – {string} –
Url to js file
dom_id(optional) – {string} –
Optional id for the script tag
Adds a function to the list of functions that poller periodically executes
fn – {function()} –
Poll function to add
Register hover function to real browser
Executes a fn asynchroniously via setTimeout(fn, delay)
.
Unlike when calling setTimeout
directly, in test this function is mocked and instead of using
setTimeout
in tests, the fns are queued in an array, which can be programmatically flushed via
$browser.defer.flush()
.
fn – {function()} –
A function, who's execution should be defered.
delay(optional=0) – {number} –
of milliseconds to defer the function execution.
Get current browser's url
Set hover listener.
listener – {function(Object, boolean)} –
Function that will be called when a hover event occurs.
callback – {function()} –
Function that will be called when no outstanding request
Detects if browser support onhashchange events and register a listener otherwise registers
$browser poller. The listener
will then get called when the hash changes.
The listener gets called with either HashChangeEvent object or simple object that also contains
oldURL
and newURL
properties.
NOTE: this api is intended for use only by the $location service. Please use the
$location service
to monitor hash changes in angular apps.
listener – {function(event)} –
Listener function to be called when url hash changes.
Sets browser's url
url – {string} –
New url
Configures the poller to run in the specified intervals, using the specified setTimeout fn and kicks it off.
interval – {number} –
How often should browser call poll functions (ms)
setTimeout – {function()} –
Reference to a real or fake setTimeout
function.
Send ajax request
method – {string} –
Requested method (get|post|put|delete|head|json)
url – {string} –
Requested url
post – {?string} –
Post data to send (null if nothing to post)
callback – {function(number, string)} –
Function that will be called on response
header(optional) – {object} –
additional HTTP headers to send with XHR. Standard headers are: