Skip to content

Commit

Permalink
fix: infinite loops are not fun for ever (with param serie:true)
Browse files Browse the repository at this point in the history
Fixes #166
  • Loading branch information
ocombe committed Apr 20, 2015
1 parent 3280c79 commit dab34c0
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 33 deletions.
16 changes: 9 additions & 7 deletions dist/modules/ocLazyLoad.loaders.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @returns {*}
*/
$delegate.filesLoader = function filesLoader(config) {
var originalParams = arguments[1] === undefined ? {} : arguments[1];
var params = arguments[1] === undefined ? {} : arguments[1];

var cssFiles = [],
templatesFiles = [],
Expand All @@ -21,8 +21,7 @@

$delegate.toggleWatch(true); // start watching angular.module calls

// we need a real copy because we might edit some parts of it
var params = angular.copy(angular.extend({}, originalParams, config));
angular.extend(params, config);

var pushFile = function pushFile(path) {
var file_type = null,
Expand Down Expand Up @@ -133,15 +132,19 @@
* @param params Object optional parameters
* @returns promise
*/
$delegate.load = function (module) {
var params = arguments[1] === undefined ? {} : arguments[1];
$delegate.load = function (originalModule) {
var originalParams = arguments[1] === undefined ? {} : arguments[1];

var self = this,
config = null,
deferredList = [],
deferred = $q.defer(),
errText;

// clean copy
var module = angular.copy(originalModule);
var params = angular.copy(originalParams);

// If module is an array, break it down
if (angular.isArray(module)) {
// Resubmit each entry as a single module
Expand Down Expand Up @@ -198,8 +201,7 @@
}
}

var localParams = {};
angular.extend(localParams, params, config);
var localParams = angular.extend({}, params, config);

// if someone used an external loader and called the load function with just the module name
if (angular.isUndefined(config.files) && angular.isDefined(config.name) && $delegate.moduleExists(config.name)) {
Expand Down
16 changes: 9 additions & 7 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.

16 changes: 9 additions & 7 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.

Loading

0 comments on commit dab34c0

Please sign in to comment.