jQuery file upload process queue

在jquery.ui.widget.js中bridge处打上断点,查看instance内容

$.widget.bridge = function( name, object ) {
    var fullName = object.prototype.widgetFullName || name;
    $.fn[ name ] = function( options ) {
        var isMethodCall = typeof options === "string",
            args = widget_slice.call( arguments, 1 ),
            returnValue = this;

        if ( isMethodCall ) {
            this.each(function() {
                var methodValue,
                    instance = $.data( this, fullName );
                if ( options === "instance" ) {
                    returnValue = instance;
                    return false;
                }
                if ( !instance ) {
                    return $.error( "cannot call methods on " + name + " prior to initialization; " +
                        "attempted to call method '" + options + "'" );
                }
                if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
                    return $.error( "no such method '" + options + "' for " + name + " widget instance" );
                }
                methodValue = instance[ options ].apply( instance, args );
                if ( methodValue !== instance && methodValue !== undefined ) {
                    returnValue = methodValue && methodValue.jquery ?
                        returnValue.pushStack( methodValue.get() ) :
                        methodValue;
                    return false;
                }
            });
        } else {

            // Allow multiple hashes to be passed on init
            if ( args.length ) {
                options = $.widget.extend.apply( null, [ options ].concat(args) );
            }

            this.each(function() {
                var instance = $.data( this, fullName );
                if ( instance ) {
                    instance.option( options || {} );
                    if ( instance._init ) {
                        instance._init();
                    }
                } else {
                    $.data( this, fullName, new object( options, this ) );
                }
            });
        }

        return returnValue;
    };
};

 

instance.options.processQueue

  1. (8) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
    1. 0: {action: "loadImageMetaData", disableImageHead: "@", disableExif: "@", disableExifThumbnail: "@", disableExifSub: "@", …}
    2. 1: {action: "loadImage", prefix: true, fileTypes: "@", maxFileSize: "@", noRevoke: "@", …}
    3. 2: {action: "resizeImage", prefix: "image", maxWidth: "@", maxHeight: "@", minWidth: "@", …}
    4. 3: {action: "saveImage", quality: "@imageQuality", type: "@imageType", disabled: "@disableImageResize"}
    5. 4: {action: "saveImageMetaData", disabled: "@disableImageMetaDataSave"}
    6. 5: {action: "resizeImage", prefix: "preview", maxWidth: "@", maxHeight: "@", minWidth: "@", …}
    7. 6: {action: "setImage", name: "@imagePreviewName", disabled: "@disableImagePreview"}
    8. 7: {action: "deleteImageReferences", disabled: "@disableImageReferencesDeletion"}

 

posted @ 2019-07-02 16:53  ChuckLu  阅读(280)  评论(0编辑  收藏  举报