mirror of
https://github.com/zoriya/react-native-background-downloader.git
synced 2026-06-01 17:45:14 +00:00
Metadata support for initial creation phase.
This commit is contained in:
+6
-10
@@ -13,17 +13,13 @@ export default class DownloadTask {
|
||||
metadata = {}
|
||||
|
||||
constructor (taskInfo, originalTask) {
|
||||
if (typeof taskInfo === 'string') {
|
||||
this.id = taskInfo
|
||||
} else {
|
||||
this.id = taskInfo.id
|
||||
this.percent = taskInfo.percent
|
||||
this.bytesWritten = taskInfo.bytesWritten
|
||||
this.totalBytes = taskInfo.totalBytes
|
||||
this.id = taskInfo.id
|
||||
this.percent = taskInfo.percent ?? 0
|
||||
this.bytesWritten = taskInfo.bytesWritten ?? 0
|
||||
this.totalBytes = taskInfo.totalBytes ?? 0
|
||||
|
||||
if (this.#parseable(taskInfo.metadata)) {
|
||||
this.metadata = JSON.parse(taskInfo.metadata);
|
||||
}
|
||||
if (this.#parseable(taskInfo.metadata)) {
|
||||
this.metadata = JSON.parse(taskInfo.metadata);
|
||||
}
|
||||
|
||||
if (originalTask) {
|
||||
|
||||
Reference in New Issue
Block a user