mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
Merge branch 'master' of https://github.com/driftyco/ionic-native
This commit is contained in:
commit
4251d1fba5
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
# http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = false
|
@ -52,6 +52,7 @@ import {LaunchNavigator} from './plugins/launchnavigator';
|
||||
import {LocalNotifications} from './plugins/localnotifications';
|
||||
import {MediaPlugin} from './plugins/media';
|
||||
import {Network, Connection} from './plugins/network';
|
||||
import {Printer} from './plugins/printer';
|
||||
import {Push} from './plugins/push';
|
||||
import {SafariViewController} from './plugins/safari-view-controller';
|
||||
import {Screenshot} from './plugins/screenshot';
|
||||
@ -85,6 +86,7 @@ export * from './plugins/inappbrowser';
|
||||
export * from './plugins/launchnavigator';
|
||||
export * from './plugins/localnotifications';
|
||||
export * from './plugins/media';
|
||||
export * from './plugins/printer';
|
||||
export * from './plugins/push';
|
||||
export * from './plugins/safari-view-controller';
|
||||
export * from './plugins/sms';
|
||||
@ -183,6 +185,7 @@ window['IonicNative'] = {
|
||||
LocalNotifications: LocalNotifications,
|
||||
MediaPlugin: MediaPlugin,
|
||||
Network: Network,
|
||||
Printer: Printer,
|
||||
Push: Push,
|
||||
SafariViewController: SafariViewController,
|
||||
Screenshot: Screenshot,
|
||||
|
@ -8,8 +8,9 @@ import {Plugin, Cordova} from './plugin';
|
||||
*@usage
|
||||
* ```js
|
||||
* import {BackgroundMode} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* BackgroundMode.enable();
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'de.appplant.cordova.plugin.background-mode',
|
||||
|
@ -34,7 +34,7 @@ export interface DeeplinkMatch {
|
||||
@Plugin({
|
||||
plugin: 'ionic-plugin-deeplinks',
|
||||
pluginRef: 'IonicDeeplink',
|
||||
repo: 'https://github.com/driftyo/ionic-plugin-deeplinks',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
export class Deeplinks {
|
||||
|
@ -14,7 +14,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-globalization',
|
||||
pluginRef: 'navigator.globalization',
|
||||
repo: 'https: //github.com/apache/cordova-plugin-globalization'
|
||||
repo: 'https://github.com/apache/cordova-plugin-globalization'
|
||||
})
|
||||
export class Globalization {
|
||||
|
||||
@ -125,4 +125,4 @@ export class Globalization {
|
||||
@Cordova()
|
||||
static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; }
|
||||
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
64
src/plugins/printer.ts
Normal file
64
src/plugins/printer.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
declare var cordova: any;
|
||||
|
||||
export interface PrintOptions {
|
||||
/**
|
||||
* The name of the print job and the document
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The network URL of the printer.
|
||||
* Only supported on iOS.
|
||||
*/
|
||||
printerId?: string;
|
||||
|
||||
/**
|
||||
* Specifies the duplex mode to use for the print job.
|
||||
* Either double-sided (duplex:true) or single-sided (duplex:false).
|
||||
* Double-sided by default.
|
||||
* Only supported on iOS
|
||||
*/
|
||||
duplex?: boolean;
|
||||
|
||||
/**
|
||||
* The orientation of the printed content, portrait or landscape
|
||||
* Portrait by default.
|
||||
*/
|
||||
landscape?: boolean;
|
||||
|
||||
/**
|
||||
* If your application only prints black text, setting this property to true can result in better performance in many cases.
|
||||
* False by default.
|
||||
*/
|
||||
grayscale?: boolean;
|
||||
|
||||
/**
|
||||
* The Size and position of the print view
|
||||
*/
|
||||
bounds?: number[] | any;
|
||||
}
|
||||
|
||||
|
||||
@Plugin({
|
||||
plugin: 'de.appplant.cordova.plugin.printer',
|
||||
pluginRef: 'cordova.plugins.printer',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class Printer {
|
||||
|
||||
/**
|
||||
* Checks whether to device is capable of printing.
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Sends content to the printer.
|
||||
* @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
|
||||
* @param {options} The options to pass to the printer
|
||||
*/
|
||||
@Cordova()
|
||||
static print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
|
||||
}
|
@ -59,7 +59,7 @@ export class SafariViewController {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static show(options?: SafariViewControllerOptions): void {}
|
||||
static show(options?: SafariViewControllerOptions): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Hides Safari View Controller
|
||||
@ -98,4 +98,4 @@ export interface SafariViewControllerOptions {
|
||||
enterReaderModeIfAvailable?: boolean;
|
||||
tintColor?: string;
|
||||
transition?: string;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,30 @@ import {CordovaInstance, Plugin, Cordova} from './plugin';
|
||||
declare var sqlitePlugin;
|
||||
/**
|
||||
* @name SQLite
|
||||
*
|
||||
* @description
|
||||
* Access SQLite databases on the device.
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabse({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql', err);
|
||||
* })
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database', err);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginRef: 'sqlitePlugin',
|
||||
@ -15,13 +39,44 @@ export class SQLite {
|
||||
return this._objectInstance.databaseFeatures;
|
||||
}
|
||||
|
||||
constructor (config: any) {
|
||||
new Promise((resolve, reject) => {
|
||||
sqlitePlugin.openDatabase(config, resolve, reject);
|
||||
}).then(
|
||||
db => this._objectInstance = db,
|
||||
error => console.warn(error)
|
||||
);
|
||||
constructor () {}
|
||||
|
||||
/**
|
||||
* Open or create a SQLite database file.
|
||||
*
|
||||
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
|
||||
*
|
||||
* @param config the config for opening the database.
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabse({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql', err);
|
||||
* })
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database', err);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
openDatabase (config: any) : Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
sqlitePlugin.openDatabase(config, db => {
|
||||
this._objectInstance = db;
|
||||
resolve(db);
|
||||
}, error => {
|
||||
console.warn(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@CordovaInstance({
|
||||
@ -48,6 +103,19 @@ export class SQLite {
|
||||
})
|
||||
start (): void {}
|
||||
|
||||
/**
|
||||
* Execute SQL on the opened database. Note, you must call `openDatabase` first, and
|
||||
* ensure it resolved and successfully opened the database.
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
|
||||
* // Access the items through resultSet.rows
|
||||
* // resultSet.rows.item(i)
|
||||
* }, (err) => {})
|
||||
* ```
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeSql (statement: string, params: any): Promise<any> {return; }
|
||||
|
||||
@ -104,4 +172,4 @@ export class SQLite {
|
||||
@Cordova()
|
||||
static deleteDatabase (first): Promise<any> {return; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export interface ToastOptions {
|
||||
*
|
||||
*
|
||||
*
|
||||
* Toast.show("I'm a toast", 5000, "center").subscribe(
|
||||
* Toast.show("I'm a toast", "5000", "center").subscribe(
|
||||
* toast => {
|
||||
* console.log(toast);
|
||||
* }
|
||||
|
Loading…
Reference in New Issue
Block a user