mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-25 04:16:09 +08:00
docs(sqlite): Add interface for transaction callback function argument (#2586)
The transaction callback function argument is currently typed as `any`, however this isn't very helpful so I have added a base interface which contains only the `executeSql` function. This function is all that is available on the object returned by WebSQL, but is also available on the full SQLite implementation.
This commit is contained in:
parent
3f9311090d
commit
713efd7206
@ -36,14 +36,20 @@ export interface SQLiteDatabaseConfig {
|
|||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
export interface SQLiteTransaction {
|
export interface DbTransaction {
|
||||||
start: () => void;
|
|
||||||
executeSql: (
|
executeSql: (
|
||||||
sql: any,
|
sql: any,
|
||||||
values: any,
|
values: any,
|
||||||
success: Function,
|
success: Function,
|
||||||
error: Function
|
error: Function
|
||||||
) => void;
|
) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hidden
|
||||||
|
*/
|
||||||
|
export interface SQLiteTransaction extends DbTransaction {
|
||||||
|
start: () => void;
|
||||||
addStatement: (
|
addStatement: (
|
||||||
sql: any,
|
sql: any,
|
||||||
values: any,
|
values: any,
|
||||||
@ -74,14 +80,14 @@ export class SQLiteObject {
|
|||||||
addTransaction(transaction: (tx: SQLiteTransaction) => void): void {}
|
addTransaction(transaction: (tx: SQLiteTransaction) => void): void {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param fn {any}
|
* @param fn {Function}
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@CordovaInstance({
|
@CordovaInstance({
|
||||||
successIndex: 2,
|
successIndex: 2,
|
||||||
errorIndex: 1
|
errorIndex: 1
|
||||||
})
|
})
|
||||||
transaction(fn: any): Promise<any> {
|
transaction(fn: (tx: DbTransaction) => void): Promise<any> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user