MCPcopy
hub / github.com/angular-ui/ui-grid / Browser

Function Browser

lib/test/angular/1.8.0/angular.js:6603–6908  ·  view source on GitHub ↗

* @param {object} window The global window object. * @param {object} document jQuery wrapped document. * @param {object} $log window.console or an object with the same interface. * @param {object} $sniffer $sniffer service

(window, document, $log, $sniffer, $$taskTrackerFactory)

Source from the content-addressed store, hash-verified

6601 * @param {object} $sniffer $sniffer service
6602 */
6603function Browser(window, document, $log, $sniffer, $$taskTrackerFactory) {
6604 var self = this,
6605 location = window.location,
6606 history = window.history,
6607 setTimeout = window.setTimeout,
6608 clearTimeout = window.clearTimeout,
6609 pendingDeferIds = {},
6610 taskTracker = $$taskTrackerFactory($log);
6611
6612 self.isMock = false;
6613
6614 //////////////////////////////////////////////////////////////
6615 // Task-tracking API
6616 //////////////////////////////////////////////////////////////
6617
6618 // TODO(vojta): remove this temporary api
6619 self.$$completeOutstandingRequest = taskTracker.completeTask;
6620 self.$$incOutstandingRequestCount = taskTracker.incTaskCount;
6621
6622 // TODO(vojta): prefix this method with $$ ?
6623 self.notifyWhenNoOutstandingRequests = taskTracker.notifyWhenNoPendingTasks;
6624
6625 //////////////////////////////////////////////////////////////
6626 // URL API
6627 //////////////////////////////////////////////////////////////
6628
6629 var cachedState, lastHistoryState,
6630 lastBrowserUrl = location.href,
6631 baseElement = document.find('base'),
6632 pendingLocation = null,
6633 getCurrentState = !$sniffer.history ? noop : function getCurrentState() {
6634 try {
6635 return history.state;
6636 } catch (e) {
6637 // MSIE can reportedly throw when there is no state (UNCONFIRMED).
6638 }
6639 };
6640
6641 cacheState();
6642
6643 /**
6644 * @name $browser#url
6645 *
6646 * @description
6647 * GETTER:
6648 * Without any argument, this method just returns current value of `location.href` (with a
6649 * trailing `#` stripped of if the hash is empty).
6650 *
6651 * SETTER:
6652 * With at least one argument, this method sets url to new value.
6653 * If html5 history api supported, `pushState`/`replaceState` is used, otherwise
6654 * `location.href`/`location.replace` is used.
6655 * Returns its own instance to allow chaining.
6656 *
6657 * NOTE: this api is intended for use only by the `$location` service. Please use the
6658 * {@link ng.$location $location service} to change url.
6659 *
6660 * @param {string} url New url (when used as setter)

Callers

nothing calls this directly

Calls 6

cacheStateFunction · 0.70
isUndefinedFunction · 0.70
urlResolveFunction · 0.70
stripHashFunction · 0.70
getHashFunction · 0.70
trimEmptyHashFunction · 0.70

Tested by

no test coverage detected