File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 180
180
*/
181
181
webkitReadDataTransfer : function ( event ) {
182
182
var $ = this ;
183
+ var queue = event . dataTransfer . items . length ;
184
+ var files = [ ] ;
183
185
each ( event . dataTransfer . items , function ( item ) {
184
186
var entry = item . webkitGetAsEntry ( ) ;
185
187
if ( ! entry ) {
193
195
}
194
196
} ) ;
195
197
function readSuccess ( entries ) {
198
+ queue += entries . length ;
196
199
each ( entries , function ( entry ) {
197
200
if ( entry . isFile ) {
198
201
var fullPath = entry . fullPath ;
203
206
entry . createReader ( ) . readEntries ( readSuccess , readError ) ;
204
207
}
205
208
} ) ;
209
+ decrement ( ) ;
206
210
}
207
211
function fileReadSuccess ( file , fullPath ) {
208
212
// relative path should not start with "/"
209
213
file . relativePath = fullPath . substring ( 1 ) ;
210
- $ . addFile ( file , event ) ;
214
+ files . push ( file ) ;
215
+ decrement ( ) ;
211
216
}
212
217
function readError ( fileError ) {
213
218
throw fileError ;
214
219
}
220
+ function decrement ( ) {
221
+ if ( -- queue == 0 ) {
222
+ $ . addFiles ( files , event ) ;
223
+ }
224
+ }
215
225
} ,
216
226
217
227
/**
You can’t perform that action at this time.
0 commit comments