The current TransferState of the transfer.
The unique identifier for this transfer
2ccc5d48-e43b-40b7-bb70-f591dc51c293
Opens destination folder chosen during the download initialization.
This simplifies the process of finding the downloaded file or files on transfer completion but is otherwise not required.
This launches a finder window for Mac or an explorer window for windows
A Promise which will resolve when the destination folder opens in a file browser.
Subscribe to a transfer event. Note that all subscriptions will automatically be removed once a download has completed.
addSubscriptions(download: Download) {
const listener = (data: TransferEventCallbackData): Promise<void> => {
const { transfer, transferEvent }: TransferEventCallbackData = data;
const { type, eventData }: TransferEvent = transferEvent;
switch (type) {
case TransferEventType.TRANSFER_STARTED:
//Cast to the associated type of event data
const progressData: TransferProgressEventData = <TransferProgressEventData>eventData;
// process as appropriate
break;
case TransferEventType.TRANSFER_COMPLETED:
const completedData: TransferCompletedEventData = <TransferCompletedEventData>eventData;
// process as appropriate
break;
}
}
download.subscribe(TransferEventType.TRANSFER_PROGRESS, startListener);
download.subscribe(TransferEventType.TRANSFER_COMPLETED, startListener);
}
The type of event we are subscribing to.
The listener we wish to assign to an event.
Unsubscribe from a transfer event
true if the listener was present and unsubscribed, false if there was no match for the eventType / listener combination.
The type of event we are unsubscribing from.
Optional
listener: TransferEventCallback<Download>The listener we wish to unsubscribe.
Generated using TypeDoc
The Download interface, extension of Transfer