mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-18 11:31:07 +00:00
refactor(api): cleaned up the externalization of angular API methods
This commit is contained in:
parent
9062996a0e
commit
4c10d33eb4
3 changed files with 31 additions and 54 deletions
|
|
@ -1015,6 +1015,34 @@ function assertArgFn(arg, name) {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function publishExternalAPI(angular){
|
||||||
|
extend(angular, {
|
||||||
|
// disabled for now until we agree on public name
|
||||||
|
//'annotate': annotate,
|
||||||
|
'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,
|
||||||
|
'version': version,
|
||||||
|
'isDate': isDate,
|
||||||
|
'lowercase': lowercase,
|
||||||
|
'uppercase': uppercase
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc property
|
* @ngdoc property
|
||||||
|
|
|
||||||
|
|
@ -11,31 +11,7 @@ angularService('$browser', function($log, $sniffer) {
|
||||||
}, {$inject: ['$log', '$sniffer']});
|
}, {$inject: ['$log', '$sniffer']});
|
||||||
|
|
||||||
|
|
||||||
extend(angular, {
|
publishExternalAPI(angular);
|
||||||
// disabled for now until we agree on public name
|
|
||||||
//'annotate': annotate,
|
|
||||||
'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,
|
|
||||||
'version': version,
|
|
||||||
'isDate': isDate,
|
|
||||||
'lowercase': lowercase,
|
|
||||||
'uppercase': uppercase
|
|
||||||
});
|
|
||||||
|
|
||||||
//try to bind to jquery now so that one can write angular.element().read()
|
//try to bind to jquery now so that one can write angular.element().read()
|
||||||
//but we will rebind on bootstrap again.
|
//but we will rebind on bootstrap again.
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,9 @@ function dumpScope(scope, offset) {
|
||||||
return log.join('\n' + offset);
|
return log.join('\n' + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishExternalAPI(angular)
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
publishExternalAPI(angular)
|
||||||
// This is to reset parsers global cache of expressions.
|
// This is to reset parsers global cache of expressions.
|
||||||
compileCache = {};
|
compileCache = {};
|
||||||
|
|
||||||
|
|
@ -80,7 +82,6 @@ beforeEach(function() {
|
||||||
$logMock.info.logs = [];
|
$logMock.info.logs = [];
|
||||||
$logMock.error.logs = [];
|
$logMock.error.logs = [];
|
||||||
|
|
||||||
resetAngularPublic()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function inject(){
|
function inject(){
|
||||||
|
|
@ -118,34 +119,6 @@ function inject(){
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method republishes the public angular API. It should probably be cleaned up somehow.
|
|
||||||
* //TODO: remove this method and merge it with the angularPublic.js class
|
|
||||||
*/
|
|
||||||
function resetAngularPublic() {
|
|
||||||
extend(angular, {
|
|
||||||
'element': jqLite,
|
|
||||||
'copy': copy,
|
|
||||||
'extend': extend,
|
|
||||||
'equals': equals,
|
|
||||||
'forEach': forEach,
|
|
||||||
'noop': noop,
|
|
||||||
'bind': bind,
|
|
||||||
'toJson': toJson,
|
|
||||||
'fromJson': fromJson,
|
|
||||||
'identity':identity,
|
|
||||||
'injector': createInjector,
|
|
||||||
'isUndefined': isUndefined,
|
|
||||||
'isDefined': isDefined,
|
|
||||||
'isString': isString,
|
|
||||||
'isFunction': isFunction,
|
|
||||||
'isObject': isObject,
|
|
||||||
'isNumber': isNumber,
|
|
||||||
'isArray': isArray
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
resetAngularPublic();
|
|
||||||
|
|
||||||
afterEach(inject(function($rootScope) {
|
afterEach(inject(function($rootScope) {
|
||||||
// release the injector
|
// release the injector
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue