mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-02 00:07:23 +08:00
Merge branch 'master' of github.com:driftyco/ionic-native
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Backlight
|
||||
* @description
|
||||
* This plugin adds turning on/off the device backlight.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Backlight } from 'ionic-native';
|
||||
*
|
||||
* // Turn backlight on
|
||||
* Backlight.on().then(() => console.log('backlight on'));
|
||||
*
|
||||
* // Turn backlight off
|
||||
* Backlight.off().then(() => console.log('backlight off'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Backlight',
|
||||
plugin: 'cordova-plugin-backlight',
|
||||
pluginRef: 'cordova.plugins.Backlight',
|
||||
repo: 'https://github.com/mebibou/cordova-plugin-backlight',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class Backlight {
|
||||
|
||||
/**
|
||||
* This function turns backlight on
|
||||
* @return {Promise<any>} Returns a promise that resolves when the backlight is on
|
||||
*/
|
||||
@Cordova()
|
||||
static on(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This function turns backlight off
|
||||
* @return {Promise<any>} Returns a promise that resolves when the backlight is off
|
||||
*/
|
||||
@Cordova()
|
||||
static off(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name Broadcaster
|
||||
* @description
|
||||
* This plugin adds exchanging events between native code and your app.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Broadcaster } from 'ionic-native';
|
||||
*
|
||||
* // Listen to events from Native
|
||||
* Broadcaster.addEventListener('eventName').then((event) => console.log(event));
|
||||
*
|
||||
* // Send event to Native
|
||||
* Broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Broadcaster',
|
||||
plugin: 'cordova-plugin-broadcaster',
|
||||
pluginRef: 'broadcaster',
|
||||
repo: 'https://github.com/bsorrentino/cordova-broadcaster',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class Broadcaster {
|
||||
|
||||
/**
|
||||
* This function listen to an event sent from the native code
|
||||
* @param eventName {string}
|
||||
* @return {Observable<any>} Returns an observable to watch when an event is received
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'removeEventListener',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static addEventListener(eventName: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* This function sends data to the native code
|
||||
* @param eventName {string}
|
||||
* @param eventData {any}
|
||||
* @return {Promise<any>} Returns a promise that resolves when an event is successfully fired
|
||||
*/
|
||||
@Cordova()
|
||||
static fireNativeEvent(eventName: string, eventData: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name LaunchReview
|
||||
* @description
|
||||
*
|
||||
* This launches the native store app in order for the user to leave a review.
|
||||
* On Android, the plugin opens the the app's storepage in the Play Store where the user can leave a review by pressing the stars to give a rating.
|
||||
* On iOS, the plugin opens the app's storepage in the App Store and focuses the Review tab, where the user can leave a review by pressing "Write a review".
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { LaunchReview } from 'ionic-native';
|
||||
*
|
||||
* const appId: string = 'yourAppId';
|
||||
* LaunchReview.launch(appId)
|
||||
* .then(() => console.log('Successfully launched store app');
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'LaunchReview',
|
||||
plugin: 'cordova-launch-review',
|
||||
pluginRef: 'LaunchReview',
|
||||
repo: 'https://github.com/dpa99c/cordova-launch-review',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class LaunchReview {
|
||||
|
||||
/**
|
||||
* Launch store app using given app ID
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static launch(appId: string): Promise<void> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var serial: any;
|
||||
|
||||
export interface SerialPermissionOptions {
|
||||
vid: string;
|
||||
pid: string;
|
||||
driver: string;
|
||||
}
|
||||
|
||||
export interface SerialOpenOptions {
|
||||
baudRate: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Serial
|
||||
* @description
|
||||
* This plugin provides functions for working with Serial connections
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```
|
||||
* import { Serial } from 'ionic-native';
|
||||
*
|
||||
* Serial.requestPermission({
|
||||
* vid: '0403',
|
||||
* pid: '6001',
|
||||
* driver: 'FtdiSerialDriver'
|
||||
* }).then(() => {
|
||||
* Serial.open({
|
||||
* baudRate: 38400
|
||||
* }).then(() => {
|
||||
* console.log('Serial connection opened');
|
||||
* });
|
||||
* }).catch((error: any) => console.log(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Serial',
|
||||
plugin: 'cordovarduino',
|
||||
pluginRef: 'serial',
|
||||
repo: 'https://github.com/xseignard/cordovarduino',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class Serial {
|
||||
|
||||
/**
|
||||
* Request permission to connect to a serial device
|
||||
*
|
||||
* @param options {SerialPermissionOptions} Options used to request serial permissions
|
||||
* @return {Promise<any>} Returns a promise that resolves when permissions are granted
|
||||
*/
|
||||
@Cordova()
|
||||
static requestPermission(options: SerialPermissionOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Open connection to a serial device
|
||||
*
|
||||
* @param options {SerialOpenOptions} Options used to open serial connection
|
||||
* @return {Promise<any>} Returns a promise that resolves when the serial connection is opened
|
||||
*/
|
||||
@Cordova()
|
||||
static open(options: SerialOpenOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write to a serial connection
|
||||
*
|
||||
* @param data {any} data to write to the serial connection
|
||||
* @return {Promise<any>} Returns a promise that resolves when the write is complete
|
||||
*/
|
||||
@Cordova()
|
||||
static write(data: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write hex to a serial connection
|
||||
*
|
||||
* @param data {any} data to write to the serial connection
|
||||
* @return {Promise<any>} Returns a promise that resolves when the write is complete
|
||||
*/
|
||||
@Cordova()
|
||||
static writeHex(data: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Read from a serial connection
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise that resolves with data read from the serial connection
|
||||
*/
|
||||
@Cordova()
|
||||
static read(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Watch the incoming data from the serial connection. Clear the watch by unsubscribing from the observable
|
||||
*
|
||||
* @returns {Observable<any>} Observable returns an observable that you can subscribe to
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static registerReadCallback(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Close the serial connection
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise that resolves when the serial connection is closed
|
||||
*/
|
||||
@Cordova()
|
||||
static close(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export type SpeechRecognitionListeningOptions = SpeechRecognitionListeningOptionsIOS | SpeechRecognitionListeningOptionsAndroid;
|
||||
|
||||
export interface SpeechRecognitionListeningOptionsIOS {
|
||||
/**
|
||||
* used language for recognition (default `"en-US"`)
|
||||
*/
|
||||
language?: string;
|
||||
|
||||
/**
|
||||
* umber of return matches (default `5`)
|
||||
*/
|
||||
matches?: number;
|
||||
|
||||
/**
|
||||
* Allow partial results to be returned (default `false`)
|
||||
*/
|
||||
showPartial?: boolean;
|
||||
}
|
||||
|
||||
export interface SpeechRecognitionListeningOptionsAndroid {
|
||||
/**
|
||||
* used language for recognition (default `"en-US"`)
|
||||
*/
|
||||
language?: string;
|
||||
|
||||
/**
|
||||
* number of return matches (maximum number of matches)
|
||||
*/
|
||||
matches?: number;
|
||||
|
||||
/**
|
||||
* displayed prompt of listener popup window
|
||||
*/
|
||||
prompt?: string;
|
||||
|
||||
/**
|
||||
* display listener popup window with prompt (default `true`)
|
||||
*/
|
||||
showPopup?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name SpeechRecognition
|
||||
* @description
|
||||
* This plugin does speech recognition using cloud services
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { SpeechRecognition } from 'ionic-native';
|
||||
*
|
||||
* // Check feature available
|
||||
* SpeechRecognition.isRecognitionAvailable()
|
||||
* .then((available: boolean) => console.log(available))
|
||||
*
|
||||
* // Start the recognition process
|
||||
* SpeechRecognition.startListening(options)
|
||||
* .subscribe(
|
||||
* (matches: Array<string>) => console.log(matches),
|
||||
* (onerror) => console.log('error:', onerror)
|
||||
* )
|
||||
*
|
||||
* // Stop the recognition process (iOS only)
|
||||
* SpeechRecognition.stopListening()
|
||||
*
|
||||
* // Get the list of supported languages
|
||||
* SpeechRecognition.getSupportedLanguages()
|
||||
* .then(
|
||||
* (languages: Array<string>) => console.log(languages),
|
||||
* (error) => console.log(error)
|
||||
* )
|
||||
*
|
||||
* // Check permission
|
||||
* SpeechRecognition.hasPermission()
|
||||
* .then((hasPermission: boolean) => console.log(hasPermission))
|
||||
*
|
||||
* // Request permissions
|
||||
* SpeechRecognition.requestPermission()
|
||||
* .then(
|
||||
* () => console.log('Granted'),
|
||||
* () => console.log('Denied')
|
||||
* )
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'SpeechRecognition',
|
||||
plugin: 'cordova-plugin-speechrecognition',
|
||||
pluginRef: 'plugins.speechRecognition',
|
||||
repo: 'https://github.com/pbakondy/cordova-plugin-speechrecognition',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class SpeechRecognition {
|
||||
|
||||
/**
|
||||
* Check feature available
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isRecognitionAvailable(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the recognition process
|
||||
* @return {Promise< Array<string> >} list of recognized terms
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
observable: true,
|
||||
|
||||
})
|
||||
static startListening(options?: SpeechRecognitionListeningOptions): Observable<Array<string>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the recognition process
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static stopListening(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of supported languages
|
||||
* @return {Promise< Array<string> >} list of languages
|
||||
*/
|
||||
@Cordova()
|
||||
static getSupportedLanguages(): Promise<Array<string>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check permission
|
||||
* @return {Promise<boolean>} has permission
|
||||
*/
|
||||
@Cordova()
|
||||
static hasPermission(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request permissions
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestPermission(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user