mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-04 00:13:06 +08:00
feat(preview-any-file): add new methods for preview-any-file cordova (#3643)
* feat(adjust): add missing wrappers for cordova api * feat(adjust): add missing wrappers for cordova api
This commit is contained in:
parent
e5f710c8bb
commit
b8de7f0721
@ -1,5 +1,18 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
export interface PreviewAnyFileOptions {
|
||||||
|
/**
|
||||||
|
* The name of the file to preview.
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
/**
|
||||||
|
* The mime type of the file to preview.
|
||||||
|
*/
|
||||||
|
mimeType: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name PreviewAnyFile
|
* @name PreviewAnyFile
|
||||||
* @description
|
* @description
|
||||||
@ -22,7 +35,18 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|||||||
* .catch((error: any) => console.error(error));
|
* .catch((error: any) => console.error(error));
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* this.previewAnyFile.previewPath('http://www.domain.com/samplefile')
|
||||||
|
* .then((res: any) => console.log(res))
|
||||||
|
* .catch((error: any) => console.error(error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Plugin({
|
@Plugin({
|
||||||
pluginName: 'PreviewAnyFile',
|
pluginName: 'PreviewAnyFile',
|
||||||
plugin: 'cordova-plugin-preview-any-file', // npm package name, example: cordova-plugin-camera
|
plugin: 'cordova-plugin-preview-any-file', // npm package name, example: cordova-plugin-camera
|
||||||
@ -43,4 +67,34 @@ export class PreviewAnyFile extends IonicNativePlugin {
|
|||||||
preview(url: string): Promise<string> {
|
preview(url: string): Promise<string> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* previewPath function will return success callback if the file successfully opened, if the content is base64 you have to use previewBase64 method
|
||||||
|
* @param base64 {String} base64 string content
|
||||||
|
* @param options {PreviewAnyFileOptions} define the name of the file with extension or it's mimeType, if the correct extension not exist in the path
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
previewBase64(base64: string,options?: PreviewAnyFileOptions): Promise<string> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* previewPath function will return success callback if the file successfully opened, if the content is base64 you have to use previewBase64 method
|
||||||
|
* @param url {String} full absolute URL -> file://, content://, http://, https, ... etc, if extension not exist, you must define it in the opt param
|
||||||
|
* @param options {PreviewAnyFileOptions} define the name of the file with extension or it's mimeType, if the correct extension not exist in the path
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
previewPath(url: string,options?: PreviewAnyFileOptions): Promise<string> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* previewPath function will return success callback if the file successfully opened, if the content is base64 you have to use previewBase64 method
|
||||||
|
* @param url {String} full absolute URL -> file://, content://, http://, https, ... etc, if extension not exist, you must define it in the opt param
|
||||||
|
* @param options {PreviewAnyFileOptions} define the name of the file with extension or it's mimeType, if the correct extension not exist in the path
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
previewAsset(url: string,options?: PreviewAnyFileOptions): Promise<string> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user