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

Function Browser

lib/test/angular/1.4.3/angular.js:5370–5693  ·  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

5368 * @param {object} $sniffer $sniffer service
5369 */
5370function Browser(window, document, $log, $sniffer) {
5371 var self = this,
5372 rawDocument = document[0],
5373 location = window.location,
5374 history = window.history,
5375 setTimeout = window.setTimeout,
5376 clearTimeout = window.clearTimeout,
5377 pendingDeferIds = {};
5378
5379 self.isMock = false;
5380
5381 var outstandingRequestCount = 0;
5382 var outstandingRequestCallbacks = [];
5383
5384 // TODO(vojta): remove this temporary api
5385 self.$$completeOutstandingRequest = completeOutstandingRequest;
5386 self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
5387
5388 /**
5389 * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
5390 * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
5391 */
5392 function completeOutstandingRequest(fn) {
5393 try {
5394 fn.apply(null, sliceArgs(arguments, 1));
5395 } finally {
5396 outstandingRequestCount--;
5397 if (outstandingRequestCount === 0) {
5398 while (outstandingRequestCallbacks.length) {
5399 try {
5400 outstandingRequestCallbacks.pop()();
5401 } catch (e) {
5402 $log.error(e);
5403 }
5404 }
5405 }
5406 }
5407 }
5408
5409 function getHash(url) {
5410 var index = url.indexOf('#');
5411 return index === -1 ? '' : url.substr(index);
5412 }
5413
5414 /**
5415 * @private
5416 * Note: this method is used only by scenario runner
5417 * TODO(vojta): prefix this method with $$ ?
5418 * @param {function()} callback Function that will be called when no outstanding request
5419 */
5420 self.notifyWhenNoOutstandingRequests = function(callback) {
5421 if (outstandingRequestCount === 0) {
5422 callback();
5423 } else {
5424 outstandingRequestCallbacks.push(callback);
5425 }
5426 };
5427

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