Skip to content

Commit

Permalink
fix: components can be registered as object maps now
Browse files Browse the repository at this point in the history
Fixes #156
  • Loading branch information
ocombe committed Apr 9, 2015
1 parent 6a5d3d4 commit 08ed860
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 79 deletions.
32 changes: 15 additions & 17 deletions dist/modules/ocLazyLoad.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,14 @@
regInvokes[moduleName][type] = {};
}
var onInvoke = function onInvoke(invokeName, signature) {
newInvoke = true;
regInvokes[moduleName][type][invokeName].push(signature);
broadcast("ocLazyLoad.componentLoaded", [moduleName, type, invokeName]);
if (angular.isUndefined(regInvokes[moduleName][type][invokeName])) {
regInvokes[moduleName][type][invokeName] = [];
}
if (regInvokes[moduleName][type][invokeName].indexOf(signature) === -1) {
newInvoke = true;
regInvokes[moduleName][type][invokeName].push(signature);
broadcast("ocLazyLoad.componentLoaded", [moduleName, type, invokeName]);
}
};

function signature(data) {
Expand All @@ -235,22 +240,15 @@
}

if (angular.isString(invokeList)) {
if (angular.isUndefined(regInvokes[moduleName][type][invokeList])) {
regInvokes[moduleName][type][invokeList] = [];
}
if (regInvokes[moduleName][type][invokeList].indexOf(signature(args[2][1])) === -1) {
onInvoke(invokeList, signature(args[2][1]));
}
onInvoke(invokeList, signature(args[2][1]));
} else if (angular.isObject(invokeList)) {
// decorators for example
angular.forEach(invokeList, function (invoke) {
angular.forEach(invokeList, function (invoke, key) {
if (angular.isString(invoke)) {
if (angular.isUndefined(regInvokes[moduleName][type][invoke])) {
regInvokes[moduleName][type][invoke] = [];
}
if (regInvokes[moduleName][type][invoke].indexOf(signature(invokeList[1])) === -1) {
onInvoke(invoke, signature(invokeList[1]));
}
// decorators for example
onInvoke(invoke, signature(invokeList[1]));
} else {
// components registered as object lists {"componentName": function() {}}
onInvoke(key, signature(invoke));
}
});
} else {
Expand Down
32 changes: 15 additions & 17 deletions dist/ocLazyLoad.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.min.js.map

Large diffs are not rendered by default.

32 changes: 15 additions & 17 deletions dist/ocLazyLoad.require.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.require.js.map

Large diffs are not rendered by default.

0 comments on commit 08ed860

Please sign in to comment.