From 7a2e93fd89f9f179c9ba061fd1bd3d2ee4902ff6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 7 Feb 2019 16:10:52 -0800 Subject: [PATCH] Revert "Merge pull request #32709 from MrBullfinsh/cordova-plugin-background-download-types" This reverts commit 401af3267f6c283b7ee95d89aad7ad99a2261d41, reversing changes made to 1d78804c81accd2557b287c4e451933d2190d4f4. --- ...ordova-plugin-background-download-tests.ts | 24 ------ .../index.d.ts | 86 ------------------- .../tsconfig.json | 24 ------ .../tslint.json | 3 - 4 files changed, 137 deletions(-) delete mode 100644 types/cordova-plugin-background-download/cordova-plugin-background-download-tests.ts delete mode 100644 types/cordova-plugin-background-download/index.d.ts delete mode 100644 types/cordova-plugin-background-download/tsconfig.json delete mode 100644 types/cordova-plugin-background-download/tslint.json diff --git a/types/cordova-plugin-background-download/cordova-plugin-background-download-tests.ts b/types/cordova-plugin-background-download/cordova-plugin-background-download-tests.ts deleted file mode 100644 index e56d14ce04..0000000000 --- a/types/cordova-plugin-background-download/cordova-plugin-background-download-tests.ts +++ /dev/null @@ -1,24 +0,0 @@ - let fileName = "PointerEventsCordovaPlugin.wmv"; - let uriString = "http://media.ch9.ms/ch9/8c03/f4fe2512-59e5-4a07-bded-124b06ac8c03/PointerEventsCordovaPlugin.wmv"; - - // open target file for download - (window as any).requestFileSystem(1, 0, (fileSystem: any) => { - fileSystem.root.getFile(fileName, { create: true }, (targetFile: File) => { - // plugin callbacks to track operation execution status and progress - const onSuccess = () => { - console.log('Done'); - }; - const onError = (err: any) => { - console.log(err); - }; - const onProgress = (progress: BackgroundTransfer.Progress) => { - console.log((100 * progress.bytesReceived / progress.totalBytesToReceive) + '%'); - }; - - const downloader = new BackgroundTransfer.BackgroundDownloader(); - // Create a new download operation. - const download = downloader.createDownload(uriString, targetFile); - // Start the download and persist the promise to be able to cancel the download. - const downloadPromise = download.startAsync().then(onSuccess, onError, onProgress); - }); - }); diff --git a/types/cordova-plugin-background-download/index.d.ts b/types/cordova-plugin-background-download/index.d.ts deleted file mode 100644 index 815d20bf66..0000000000 --- a/types/cordova-plugin-background-download/index.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -// Type definitions for cordova-plugin-background-download 0.5 -// Project: https://github.com/sgrebnov/cordova-plugin-background-download -// Definitions by: Tobias Gimpel -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.2 - -/** - * Provides an advanced file transfer functionality that persists beyond app termination and - * runs in the background. Background transfer doesn't support concurrent downloads of the same uri. - */ -declare namespace BackgroundTransfer { - class BackgroundDownloader { - /** - * Initializes a new instance of BackgroundDownloader object. - * Used to configure downloads prior to the actual creation of the download operation using CreateDownload. - * - * @param uriMatcher The regexp to compare location of the resources with already downloading ones. - */ - constructor(uriMatcher?: RegExp); - /** - * Initializes a DownloadOperation object that contains the specified Uri and the file that the response is written to. - * - * @param uri The location of the resource. - * @param resultFile The file that the response will be written to. - * @param notificationTitle The title for downloading in notification. - */ - createDownload(uri: string, resultFile: File, notificationTitle?: string): DownloadOperation; - } - - interface Progress { - bytesReceived: number; - totalBytesToReceive: number; - } - - /** - * Provides a mechanism for managing interactions with asynchronous APIs based on Promises. - * See 'Asynchronous programming in JavaScript' for more details - * http://msdn.microsoft.com/en-us/library/windows/apps/hh700330.aspx - * http://msdn.microsoft.com/en-us/library/windows/apps/br211867.aspx - * Note. Functionality is limited, support of .then and .cancel methods only, other methods are in progress. - */ - interface Promise { - _completeCallbacks: Array<() => void>; - _errorCallbacks: Array<(error: any) => void>; - _progressCallbacks: Array<(progress: Progress) => void>; - _chainedDefer: Deferral; - _state: 'pending' | 'resolved' | 'rejected' | 'cancelled'; - result: any; - then(onComplete?: () => void, onError?: (error: any) => void, onProgress?: (progress: Progress) => void): Promise; - /** - * Attempts to cancel the fulfillment of a promised value. If the promise hasn't already been fulfilled and - * cancellation is supported, the promise enters the error state with a value of Error("Canceled"). - * http://msdn.microsoft.com/en-us/library/windows/apps/br211667.aspx - * @param flag - */ - cancel(flag?: boolean): void; - executeCallback(callback: (() => void) | ((error: any) => void) | ((progress: Progress) => void), args: any): void; - } - - interface Deferral { - resolve(data: any): void; - reject(error: any): void; - notify(value: any): void; - bind(promise: Promise): void; - } -} - -declare class DownloadOperation { - /** - * Performs an asynchronous download operation in the background. - * - * @param uri The location of the resource. - * @param resultFile The file that the response will be written to. - * @param uriMatcher The regexp to compare location of the resources with already downloading ones. - * @param notificationTitle The title for downloading in notification. - */ - constructor(uri: string, resultFile: File, uriMatcher?: RegExp, notificationTitle?: string); - /** - * Starts an asynchronous download operation. - */ - startAsync(): BackgroundTransfer.Promise; - /** - * Stops a download operation. - */ - stop(): void; -} diff --git a/types/cordova-plugin-background-download/tsconfig.json b/types/cordova-plugin-background-download/tsconfig.json deleted file mode 100644 index 830f1483ca..0000000000 --- a/types/cordova-plugin-background-download/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cordova-plugin-background-download-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cordova-plugin-background-download/tslint.json b/types/cordova-plugin-background-download/tslint.json deleted file mode 100644 index e60c15844f..0000000000 --- a/types/cordova-plugin-background-download/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} \ No newline at end of file