MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / Browser

Function Browser

lib/test/angular/1.7.0/angular.js:6456–6784  ·  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)

Source from the content-addressed store, hash-verified

6454 * @param {object} $sniffer $sniffer service
6455 */
6456function Browser(window, document, $log, $sniffer) {
6457 var self = this,
6458 location = window.location,
6459 history = window.history,
6460 setTimeout = window.setTimeout,
6461 clearTimeout = window.clearTimeout,
6462 pendingDeferIds = {};
6463
6464 self.isMock = false;
6465
6466 var outstandingRequestCount = 0;
6467 var outstandingRequestCallbacks = [];
6468
6469 // TODO(vojta): remove this temporary api
6470 self.$$completeOutstandingRequest = completeOutstandingRequest;
6471 self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
6472
6473 /**
6474 * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
6475 * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
6476 */
6477 function completeOutstandingRequest(fn) {
6478 try {
6479 fn.apply(null, sliceArgs(arguments, 1));
6480 } finally {
6481 outstandingRequestCount--;
6482 if (outstandingRequestCount === 0) {
6483 while (outstandingRequestCallbacks.length) {
6484 try {
6485 outstandingRequestCallbacks.pop()();
6486 } catch (e) {
6487 $log.error(e);
6488 }
6489 }
6490 }
6491 }
6492 }
6493
6494 function getHash(url) {
6495 var index = url.indexOf('#');
6496 return index === -1 ? '' : url.substr(index);
6497 }
6498
6499 /**
6500 * @private
6501 * TODO(vojta): prefix this method with $$ ?
6502 * @param {function()} callback Function that will be called when no outstanding request
6503 */
6504 self.notifyWhenNoOutstandingRequests = function(callback) {
6505 if (outstandingRequestCount === 0) {
6506 callback();
6507 } else {
6508 outstandingRequestCallbacks.push(callback);
6509 }
6510 };
6511
6512 //////////////////////////////////////////////////////////////
6513 // URL API

Callers

nothing calls this directly

Calls 6

callbackFunction · 0.70
cacheStateFunction · 0.70
isUndefinedFunction · 0.70
stripHashFunction · 0.70
getHashFunction · 0.70

Tested by

no test coverage detected