Class: Queue

Queue Class

Namespace

ITHit.WebDAV.Client.Upload

List of items being uploaded. Each item in the list describes the file or folder upload state and provides methods for managing upload.
Fires:

Members

Gets or Sets OnUploadItemsCreatedCallback handler.
Associated uploader.

Methods

AddListener(sEventName, fCallback, oContext)

Add event handlers.
Name Type Description
sEventName string The event name to handle.
fCallback function The callback to call.
oContext Object optional The context to callback is called with.

RemoveByUrl(sUrl)

Removes upload file from queue.
Name Type Description
sUrl string The url of UploadItem to remove.

RemoveListener(sEventName, fCallback, oContext)

Removes event listener.
Name Type Description
sEventName string The event name to remove.
fCallback function The callback to remove.
oContext Object optional The context to callback is called with.

Restart(aUploadItems)

Name Type Description
aUploadItems Array.<ITHit.WebDAV.Client.Upload.UploadItem> Collection restart.

Type Definitions

OnUploadItemsCreatedCallback(oEvent)

Callback function to be called when ITHit.WebDAV.Client.Upload.UploadItems created and waited until one of action called.
Name Type Description
oEvent ITHit.WebDAV.Client.Upload.Events.UploadItemsCreated Event Object
Example
var oUploader = new ITHit.WebDAV.Client.Upload.Uploader();
oUploader.Queue.OnUploadItemsCreatedCallback = function(oUploadItemsCreated) {
    var aIgnoredNames = ['file1.txt', 'file2.txt'];

    /** @typedef {ITHit.WebDAV.Client.Upload.UploadItem[]} aItems */
    var aItems = oUploadItemsCreated.Items;
    aItems.forEach(function(oItem) {
        if(aIgnoredNames.indexOf(oItem.GetName()) >= 0) oItem.SetSkip(true);
    }

     oUploadItemsCreated.Upload();
});

Events

OnQueueChanged

Event reporting that queue changed. Fired when item is added or deleted from queue.
Properties:
Name Type Description
Sender ITHit.WebDAV.Client.Upload.Queue The queue instance.
Name string Event name.
AddedItems Array.<ITHit.WebDAV.Client.Upload.UploadItem> Added items.
RemovedItems Array.<ITHit.WebDAV.Client.Upload.UploadItem> Removed items.
Example
var oUploader = new ITHit.WebDAV.Client.Upload.Uploader();
             oUploader.Queue.AddListener('OnQueueChanged', function (oQueueChanged) {

                 oQueueChanged.AddedItems.forEach(function(element) {
                     console.log('Upload added:' + element.GetName());
                 });
              };