Skip to content

Commit

Permalink
Merge pull request #7 from tunapanda/dep-handling
Browse files Browse the repository at this point in the history
Gracefully handle missing dependencies
  • Loading branch information
Jakeii authored Jan 16, 2017
2 parents e0be841 + 4a6849a commit 8df6e15
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dist/js/h5p-standalone-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9641,6 +9641,10 @@ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr =
var dependency = dependencies.find(function (dept) {
return dept.name === dependencyName;
});
if (typeof dependency === "undefined") {
console.warn("Skipping unmet dependency " + dependencyName);
return;
}
Array.prototype.push.apply(styles, dependency.styles);
Array.prototype.push.apply(scripts, dependency.scripts);
});
Expand Down
8 changes: 4 additions & 4 deletions dist/js/h5p-standalone-main.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/js/h5pintegration.es6
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
let dependency = dependencies.find(function (dept) {
return dept.name === dependencyName;
});
if (typeof dependency === "undefined") {
console.warn("Skipping unmet dependency " + dependencyName);
return;
}
Array.prototype.push.apply(styles, dependency.styles);
Array.prototype.push.apply(scripts, dependency.scripts);
});
Expand Down
4 changes: 4 additions & 0 deletions src/js/h5pintegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr =
var dependency = dependencies.find(function (dept) {
return dept.name === dependencyName;
});
if (typeof dependency === "undefined") {
console.warn("Skipping unmet dependency " + dependencyName);
return;
}
Array.prototype.push.apply(styles, dependency.styles);
Array.prototype.push.apply(scripts, dependency.scripts);
});
Expand Down

0 comments on commit 8df6e15

Please sign in to comment.