Skip to content
Browse files

Ensure that loadFile's response is forEachable

  • Loading branch information...
1 parent ddc0d1a commit bd8d754c3ee4c286b5f3d2bd22d697d746cc019f @kriszyp committed Aug 22, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 media.js
View
9 media.js
@@ -64,7 +64,14 @@ Media.optimumMedia = function(source, acceptTypeHeader){
if("*/*" == type || mediaType == type){;
checkMedia({
serialize: function(){
- return exports.loadFile(alternate);
+ return {
+ // loadFile could return a promise
+ forEach: function(each){
+ return when(exports.loadFile(alternate), function(file){
+ file.forEach(each);
+ });
+ }
+ };
},
getQuality: function(){
return +(alternate.q || 0.5);

0 comments on commit bd8d754

Please sign in to comment.
Something went wrong with that request. Please try again.