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

Function Browser

lib/test/angular/1.6.7/angular.js:6396–6726  ·  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

6394 * @param {object} $sniffer $sniffer service
6395 */
6396function Browser(window, document, $log, $sniffer) {
6397 var self = this,
6398 location = window.location,
6399 history = window.history,
6400 setTimeout = window.setTimeout,
6401 clearTimeout = window.clearTimeout,
6402 pendingDeferIds = {};
6403
6404 self.isMock = false;
6405
6406 var outstandingRequestCount = 0;
6407 var outstandingRequestCallbacks = [];
6408
6409 // TODO(vojta): remove this temporary api
6410 self.$$completeOutstandingRequest = completeOutstandingRequest;
6411 self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
6412
6413 /**
6414 * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
6415 * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
6416 */
6417 function completeOutstandingRequest(fn) {
6418 try {
6419 fn.apply(null, sliceArgs(arguments, 1));
6420 } finally {
6421 outstandingRequestCount--;
6422 if (outstandingRequestCount === 0) {
6423 while (outstandingRequestCallbacks.length) {
6424 try {
6425 outstandingRequestCallbacks.pop()();
6426 } catch (e) {
6427 $log.error(e);
6428 }
6429 }
6430 }
6431 }
6432 }
6433
6434 function getHash(url) {
6435 var index = url.indexOf('#');
6436 return index === -1 ? '' : url.substr(index);
6437 }
6438
6439 /**
6440 * @private
6441 * Note: this method is used only by scenario runner
6442 * TODO(vojta): prefix this method with $$ ?
6443 * @param {function()} callback Function that will be called when no outstanding request
6444 */
6445 self.notifyWhenNoOutstandingRequests = function(callback) {
6446 if (outstandingRequestCount === 0) {
6447 callback();
6448 } else {
6449 outstandingRequestCallbacks.push(callback);
6450 }
6451 };
6452
6453 //////////////////////////////////////////////////////////////

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