Skip to content

Commit

Permalink
fix: Fix loading with global "define" set to null
Browse files Browse the repository at this point in the history
It seems that some websites have a global "define" object set to null.
This caused our module loader to break when Shaka Player was loaded.

By checking for "define" to have a "function" type, rather than just
being defined at all, we can avoid this problem.

Closes shaka-project#2847

Change-Id: I645f61687b9ec298bcc51c8d128398cdad3dd3b9
  • Loading branch information
joeyparrish authored and Mathias DIDIER committed Sep 25, 2020
1 parent 842189f commit 6620e9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion build/wrapper.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
for (var k in exportTo.shaka) {
exports[k] = exportTo.shaka[k];
}
} else if (typeof define != 'undefined' && define.amd) {
} else if (typeof define == 'function' && define.amd) {
// AMD module loader.
define(function(){
return exportTo.shaka;
Expand Down

0 comments on commit 6620e9d

Please sign in to comment.