nl_tokens: Upload next chunk from the queue
pl_tokens: function ( preventEvents ) { // In some cases (such as videos) it's really handy to upload the first // and last chunk of a file quickly; this let's the server check the file's // metadata and determine if there's even a point in continuing. var found = false ; if ( this . opts . prioritizeFirstAndLastChunk ) { each ( this . files , function ( file ) { if ( ! file . paused && file . chunks . length && file . chunks [ 0 ] . status ( ) === 'pending' ) { file . chunks [ 0 ] . send ( ) ; found = true ; return false ; } if ( ! file . paused && file . chunks . length > 1 && file . chunks [ file . chunks . length - 1 ] . status ( ) === 'pending' ) { file . chunks [ file . chunks . length - 1 ] . send ( ) ; found = true ; return false ; } } ) ; if ( found ) { return found ; } } // Now, simply look for the next, best thing to upload each ( this . files , function ( file ) { if ( ! file . paused ) { each ( file . chunks , function ( chunk ) { if ( chunk . status ( ) === 'pending' ) { chunk . send ( ) ; found = true ; return false ; } } ) ; } if ( found ) { return <mask> ; } } ) ; if ( found ) { return true ; } // The are no more outstanding chunks to upload, check is everything is done var outstanding = false ; each ( this . files , function ( file ) { if ( ! file . isComplete ( ) ) { outstanding = true ; return false ; } } ) ; if ( ! outstanding && ! preventEvents ) { // All chunks have been uploaded, complete async ( function ( ) { this . fire ( 'complete' ) ; } , this ) ; } return false ; }