File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 180180 */
181181 webkitReadDataTransfer : function ( event ) {
182182 var $ = this ;
183+ var queue = event . dataTransfer . items . length ;
184+ var files = [ ] ;
183185 each ( event . dataTransfer . items , function ( item ) {
184186 var entry = item . webkitGetAsEntry ( ) ;
185187 if ( ! entry ) {
193195 }
194196 } ) ;
195197 function readSuccess ( entries ) {
198+ queue += entries . length ;
196199 each ( entries , function ( entry ) {
197200 if ( entry . isFile ) {
198201 var fullPath = entry . fullPath ;
203206 entry . createReader ( ) . readEntries ( readSuccess , readError ) ;
204207 }
205208 } ) ;
209+ decrement ( ) ;
206210 }
207211 function fileReadSuccess ( file , fullPath ) {
208212 // relative path should not start with "/"
209213 file . relativePath = fullPath . substring ( 1 ) ;
210- $ . addFile ( file , event ) ;
214+ files . push ( file ) ;
215+ decrement ( ) ;
211216 }
212217 function readError ( fileError ) {
213218 throw fileError ;
214219 }
220+ function decrement ( ) {
221+ if ( -- queue == 0 ) {
222+ $ . addFiles ( files , event ) ;
223+ }
224+ }
215225 } ,
216226
217227 /**
You can’t perform that action at this time.
0 commit comments