Ext.ux.Deferred icon indicating copy to clipboard operation
Ext.ux.Deferred copied to clipboard

how could I resolve Synchronously like normal

Open jumplee opened this issue 10 years ago • 2 comments

I do ajax ,unless the video have selected,but it don't trigger done as promised ,why?

code like below

        var ctrl=this;
        var promise=dfd.promise();
        var fileURL= _.get('logYuluAddPanel #add_video').get('url')[0];
        var image_list = _.get('logYuluAddPanel #image_list');
        var t = image_list.getStore();
        if (t.getCount() !== 0) {
            var adjustNumber=0.5
        }else{
            var adjustNumber=1;
        }
        //no video
        if(fileURL.length===0){
   //         setTimeout(function(){
                dfd.resolve();
   //         },100);
            return promise;
        }
        var ft = new FileTransfer();
        var options = new FileUploadOptions();

        options.fileKey = "file";
        options.fileName = fileURL;
        options.mimeType = "video/quicktime";
        options.chunkedMode = false;
        var params = {};
        params.record_id = yulu_id;
        params.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
        params.orientation =  ctrl.getVideo()._orientation;

        options.params = params;
        ft.onprogress  = function(event) {
            console.log(event.lengthComputable);
            console.log(event.loaded);
            console.log( event.loaded / event.total);
            if (event.lengthComputable) {
                var percent = event.loaded / event.total ;
            }
            if(adjustNumber===1){
                _.get('yuluUpdateMessage').setData({
                    counter : percent*100
                })
            }else{
                _.get('yuluUpdateMessage').setData({
                    counter : 50+percent*50
                })
            }

        };
        function win(r) {

             dfd.resolve();
        }

        function fail(error) {
            console.log("upload error source " + error.source);
            console.log("upload error target " + error.target);
        }

        ft.upload(fileURL, _.baseUrl + 'uploadVideo_UploadImgAction.pdl!', win, fail, options);

        return promise


jumplee avatar Jan 14 '15 12:01 jumplee

I find the same issue at the #6

jumplee avatar Jan 15 '15 07:01 jumplee

Testing on sencha touch 2.4.1,find the bug

jumplee avatar Jan 15 '15 12:01 jumplee