mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-11 15:37:41 +00:00
GUAC-919: Copy Angular changes from old GUAC-546 branch.
This commit is contained in:
committed by
Michael Jumper
parent
ac2617b92a
commit
5c43ae4ff9
35
guacamole/src/main/webapp/lib/angular-module-shim.js
vendored
Normal file
35
guacamole/src/main/webapp/lib/angular-module-shim.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
/**
|
||||
* Workaround to make defining and retrieving angular modules easier and more intuitive.
|
||||
* https://gist.github.com/hiddentao/7300694
|
||||
*/
|
||||
|
||||
(function(angular) {
|
||||
var origMethod = angular.module;
|
||||
|
||||
var alreadyRegistered = {};
|
||||
|
||||
/**
|
||||
* Register/fetch a module.
|
||||
*
|
||||
* @param name {string} module name.
|
||||
* @param reqs {array} list of modules this module depends upon.
|
||||
* @param configFn {function} config function to run when module loads (only applied for the first call to create this module).
|
||||
* @returns {*} the created/existing module.
|
||||
*/
|
||||
angular.module = function(name, reqs, configFn) {
|
||||
reqs = reqs || [];
|
||||
var module = null;
|
||||
|
||||
if (alreadyRegistered[name]) {
|
||||
module = origMethod(name);
|
||||
module.requires.push.apply(module.requires, reqs);
|
||||
} else {
|
||||
module = origMethod(name, reqs, configFn);
|
||||
alreadyRegistered[name] = module;
|
||||
}
|
||||
|
||||
return module;
|
||||
};
|
||||
|
||||
})(angular);
|
Reference in New Issue
Block a user