-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(multiple-document-picker): add plugin (#3551)
* feat(multiple-document-picker): add plugin * removed package json related changes
- Loading branch information
1 parent
46853b4
commit 78e9242
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/@ionic-native/plugins/multiple-document-picker/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* This is a wrapper for MultipleDocumentsPicker plugin | ||
* | ||
*/ | ||
import { Injectable } from '@angular/core'; | ||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; | ||
|
||
/** | ||
* @name Multiple Documents Picker | ||
* @description | ||
* This plugin allows users to pick multiple documents/images at once | ||
* | ||
* @usage | ||
* ```typescript | ||
* import { MultipleDocumentsPicker } from '@ionic-native/multiple-document-picker/ngx'; | ||
* | ||
* | ||
* constructor(private multipleDocumentsPicker: MultipleDocumentsPicker) { } | ||
* | ||
* ... | ||
* | ||
* | ||
* this.multipleDocumentsPicker.pick(1) | ||
* .then((res: any) => console.log(res)) | ||
* .catch((error: any) => console.error(error)); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
pluginName: 'MultipleDocumentsPicker', | ||
plugin: 'cordova-plugin-multiple-documents-picker', | ||
pluginRef: 'multipleDocumentsPicker', | ||
repo: 'https://github.com/akeotech/cordova-plugin-multiple-documents-picker', | ||
platforms: ['Android', 'iOS'], | ||
}) | ||
@Injectable() | ||
export class MultipleDocumentsPicker extends IonicNativePlugin { | ||
/** | ||
* This function allow user to show native file picker | ||
* @param type {number} To pick type of files: for images send 1, for all files send 2 | ||
* @return {Promise<any>} Returns a promise that resolves when something happens | ||
*/ | ||
@Cordova() | ||
pick(type: number): Promise<any> { | ||
return; // We add return; here to avoid any IDE / Compiler errors | ||
} | ||
} |