File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 132132 this . fire ( "abort-queue" , { instance :this } , { prefix :true } ) ;
133133 } ,
134134
135- handleProgress : function ( e ) {
136- this . fire ( "progress" , {
137- percent : e . totalSize / e . position ,
138- total : e . totalSize ,
139- current : e . position
140- } , { prefix :true } ) ;
141- } ,
142-
143135 addHeader : function ( name , value ) {
144136 this . options . headers = this . options . headers || [ ] ;
145137 this . options . headers . push ( { name :name , value :value } ) ;
Original file line number Diff line number Diff line change 116116 } ,
117117
118118 handleProgress : function ( e ) {
119- var detail = {
120- percent : e . total || e . totalSize / e . loaded || e . position ,
121- total : e . total || e . totalSize ,
122- current : e . loaded || e . position
123- } ;
119+ var detail = this . _getProgressDetail ( e ) ;
124120 if ( this . progress ) {
125121 this . progress ( detail ) ;
126122 }
127123 this . fire ( 'progress' , detail ) ;
128124 } ,
129125
126+ _getProgressDetail ( e ) {
127+ var current = e . loaded || e . position ;
128+ var total = e . total || e . totalSize ;
129+
130+ return {
131+ percent : Math . round ( current / total * 100 ) ,
132+ total : e . total || e . totalSize ,
133+ current : e . loaded || e . position
134+ } ;
135+ } ,
136+
130137 responseHandler : {
131138
132139 xml : function ( ) {
You can’t perform that action at this time.
0 commit comments