mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-18 15:50:22 +00:00
camelcase is used for other angular functions and forEach is also used by EcmaScript standard. - rename the internal as well as the external function name - tweak the implementation of the function so that it doesn't clober it self when we extend the angular object with an object that has a forEach property equal to this forEach function Closes #85
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
var browserSingleton;
|
|
/**
|
|
* @workInProgress
|
|
* @ngdoc service
|
|
* @name angular.service.$browser
|
|
* @requires $log
|
|
*
|
|
* @description
|
|
* Represents the browser.
|
|
*/
|
|
angularService('$browser', function($log){
|
|
if (!browserSingleton) {
|
|
browserSingleton = new Browser(window, jqLite(window.document), jqLite(window.document.body),
|
|
XHR, $log);
|
|
var addPollFn = browserSingleton.addPollFn;
|
|
browserSingleton.addPollFn = function(){
|
|
browserSingleton.addPollFn = addPollFn;
|
|
browserSingleton.startPoller(100, function(delay, fn){setTimeout(delay,fn);});
|
|
return addPollFn.apply(browserSingleton, arguments);
|
|
};
|
|
browserSingleton.bind();
|
|
}
|
|
return browserSingleton;
|
|
}, {$inject:['$log']});
|
|
|
|
extend(angular, {
|
|
'element': jqLite,
|
|
'compile': compile,
|
|
'scope': createScope,
|
|
'copy': copy,
|
|
'extend': extend,
|
|
'equals': equals,
|
|
'forEach': forEach,
|
|
'injector': createInjector,
|
|
'noop':noop,
|
|
'bind':bind,
|
|
'toJson': toJson,
|
|
'fromJson': fromJson,
|
|
'identity':identity,
|
|
'isUndefined': isUndefined,
|
|
'isDefined': isDefined,
|
|
'isString': isString,
|
|
'isFunction': isFunction,
|
|
'isObject': isObject,
|
|
'isNumber': isNumber,
|
|
'isArray': isArray
|
|
});
|
|
|