UNPKG

@triniwiz/nativescript-downloader

Version:

Download Manager for NativeScript

27 lines 858 B
import { Observable } from '@nativescript/core'; export class DownloaderBase extends Observable { constructor() { super(); } } export function generateId() { if (global.isIOS) { return NSUUID.UUID().UUIDString; } if (global.isAndroid) { return java.util.UUID.randomUUID().toString(); } return 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { const r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8; return v.toString(16); }); } export var StatusCode; (function (StatusCode) { StatusCode["PENDING"] = "pending"; StatusCode["PAUSED"] = "paused"; StatusCode["DOWNLOADING"] = "downloading"; StatusCode["COMPLETED"] = "completed"; StatusCode["ERROR"] = "error"; })(StatusCode || (StatusCode = {})); //# sourceMappingURL=common.js.map