mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-01 02:53:03 +08:00
parent
0cf7d6aca1
commit
21d8122257
@ -43,6 +43,7 @@ import { EstimoteBeacons } from './plugins/estimote-beacons';
|
||||
import { Facebook } from './plugins/facebook';
|
||||
import { File } from './plugins/file';
|
||||
import { FileChooser } from './plugins/file-chooser';
|
||||
import { FileOpener } from './plugins/file-opener';
|
||||
import { Transfer } from './plugins/filetransfer';
|
||||
import { Flashlight } from './plugins/flashlight';
|
||||
import { Geofence } from './plugins/geofence';
|
||||
@ -175,6 +176,7 @@ EmailComposer,
|
||||
EstimoteBeacons,
|
||||
File,
|
||||
FileChooser,
|
||||
FileOpener,
|
||||
Flashlight,
|
||||
Geofence,
|
||||
Globalization,
|
||||
@ -255,6 +257,7 @@ window['IonicNative'] = {
|
||||
Facebook: Facebook,
|
||||
File: File,
|
||||
FileChooser: FileChooser,
|
||||
FileOpener: FileOpener,
|
||||
Flashlight: Flashlight,
|
||||
Geofence: Geofence,
|
||||
Geolocation: Geolocation,
|
||||
|
54
src/plugins/file-opener.ts
Normal file
54
src/plugins/file-opener.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
/**
|
||||
* @name FileOpener
|
||||
* @description
|
||||
* This plugin will open a file on your device file system with its default application.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {FileOpener} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-file-opener2',
|
||||
pluginRef: 'cordova.plugins.fileOpener2',
|
||||
repo: 'https://github.com/pwlin/cordova-plugin-file-opener2'
|
||||
})
|
||||
export class FileOpener {
|
||||
/**
|
||||
* Open an file
|
||||
* @param filePath {string} File Path
|
||||
* @param fileMIMEType {string} File MIME Type
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'object',
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static open(filePath: string, fileMIMEType: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Uninstalls a package
|
||||
* @param packageId {string} Package ID
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'object',
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static uninstall(packageId: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Check if an app is already installed
|
||||
* @param packageId {string} Package ID
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'object',
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
static appIsInstalled(packageId: string): Promise<any> {return; }
|
||||
}
|
@ -56,6 +56,11 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
} else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
|
||||
let obj: any = {};
|
||||
obj[opts.successName] = resolve;
|
||||
obj[opts.errorName] = reject;
|
||||
args.push(obj);
|
||||
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
// If we've specified a success/error index
|
||||
args.splice(opts.successIndex, 0, resolve);
|
||||
|
Loading…
Reference in New Issue
Block a user