-
Notifications
You must be signed in to change notification settings - Fork 3
CupDelegate
This class is the protocol for CupDelegate objects. The methods in this class for the most part correspond to jQuery File Upload [callbacks](https://github.com/blueimp/jQuery File Upload/wiki/Options#callback-options).
This class can either be subclassed, or can be used as a template for your own delegates. If you subclass, be sure to provide the appropriate functionality for those methods that expect something to be done. If you are only using this as a template, you only need to implement the methods that you intend to add some functionality to.
All of the methods receive as their first parameter the Cup object of which the receiver is a delegate. The methods that are related to a file also receive the CupFile object that is being operated on.
If the delegate wants access to the underlying jQuery event or jQuery File Upload data object that is current, it can use the methods [cup currentEvent]
or [cup currentData]
.
An attempt was made to add a file to the queue but it was rejected. The reasons for being rejected are given in filterFlags, which is a bitwise OR of the CupFiltered flags.
A file is about to be added to the queue. If you want to reject the file for some reason, return NO. Otherwise return YES.
A file was added to the queue.
The queue was started. All files in the queue will be submitted for uploading.
A file is about to be submitted for uploading. To prevent the file from being submitted, return NO, otherwise return YES.
A submitted file is about to begin uploading. To abort the upload, return NO, otherwise return YES.
A file chunk is about to begin uploading. To abort the upload, return NO, otherwise return YES.
A chunk was successfully uploaded.
A chunk failed to upload, either because of a connection error or because the upload was stopped.
Processing of a chunk completed. This is called after cup:chunkDidSucceedForFile:
or cup:chunkDidFailForFile:
.
Called periodically to update the progress a single file. The progress object contains the following properties:
- uploadedBytes – Total bytes uploaded so far
- total – The total to be uploaded
- bitrate – The average bitrate so far
Called periodically to update the overall progress of the queue. The progress object contains the following properties:
- uploadedBytes – Total bytes uploaded so far
- total – The total to be uploaded
- bitrate – The average bitrate so far
A file was successfully uploaded.
A file failed to upload, either because of a connection error or because the upload was stopped.
A file upload has completed, either through success or failure. This method is called after cup:uploadDidSucceedForFile:
or cup:uploadDidFailForFile:
.
A file upload was stopped, either individually or because the entire queue was stopped.
The queue stopped uploading, either because all files in the queue completed or because the stop:
action was triggered.
The user selected files to add to the queue through a file selection dialog. An array of Javascript File objects (not CupFile objects) is passed in the files
parameter.
The Cup start:
action method was triggered.
The Cup clearQueue:
action method was triggered.
The Cup stop:
action method was triggered. This method is called before the individual files are stopped, so you can determine why a file was stopped.
One or more files were pasted into the Cup window. An array of Javascript File objects (not CupFile objects) is passed in the files
parameter.
One or more files were dropped onto the Cup drop target. An array of Javascript File objects (not CupFile objects) is passed in the files
parameter.
Called periodically while files are being dragged over the Cup drop target.