-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copied from: DefinitelyTyped/DefinitelyTyped#13081 ref: #657
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Type definitions for cordova-sqlite-storage 1.5 | ||
// Project: https://github.com/litehelpers/Cordova-sqlite-storage | ||
// Definitions by: rafw87 <https://github.com/rafw87/> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
interface Window { | ||
sqlitePlugin: SQLitePlugin.SQLite; | ||
} | ||
|
||
declare var sqlitePlugin: SQLitePlugin.SQLite; | ||
|
||
declare namespace SQLitePlugin { | ||
type TransactionFunction = (tx: Transaction) => void; | ||
|
||
type SuccessCallback = () => void; | ||
type DatabaseSuccessCallback = (db: Database) => void; | ||
type StatementSuccessCallback = (results: Results) => void; | ||
type TransactionStatementSuccessCallback = (tx: Transaction, results: Results) => void; | ||
|
||
type ErrorCallback = (err: Error) => void; | ||
type TransactionStatementErrorCallback = (tx: Transaction, err: Error) => boolean|void; | ||
|
||
interface OpenArgs { | ||
name: string; | ||
location?: string; | ||
iosDatabaseLocation?: string; | ||
androidDatabaseImplementation?: number; | ||
androidLockWorkaround?: number; | ||
createFromLocation?: number; | ||
[key: string]: any; | ||
} | ||
interface DeleteArgs { | ||
name: string; | ||
location?: string; | ||
iosDatabaseLocation?: string; | ||
} | ||
|
||
interface Results { | ||
rowsAffected: number; | ||
insertId?: number; | ||
rows: { | ||
length: number; | ||
item(i: number): any; | ||
}; | ||
} | ||
|
||
interface Transaction { | ||
executeSql(statement: string, params?: any[], success?: TransactionStatementSuccessCallback, error?: TransactionStatementErrorCallback): void; | ||
} | ||
|
||
interface Database { | ||
transaction(fn: TransactionFunction, error?: ErrorCallback, success?: SuccessCallback): void; | ||
readTransaction(fn: TransactionFunction, error?: ErrorCallback, success?: SuccessCallback): void; | ||
|
||
executeSql(statement: string, params?: any[], success?: StatementSuccessCallback, error?: ErrorCallback): void; | ||
sqlBatch (sqlStatements: Array<string|[string, any[]]>, success?: SuccessCallback, error?: ErrorCallback): void; | ||
|
||
close(success?: SuccessCallback, error?: ErrorCallback): void; | ||
} | ||
|
||
interface SQLite { | ||
openDatabase(args: OpenArgs, success?: DatabaseSuccessCallback, error?: ErrorCallback): Database; | ||
deleteDatabase(args: DeleteArgs, success?: SuccessCallback, error?: ErrorCallback): void; | ||
selfTest(success?: SuccessCallback, error?: ErrorCallback): void; | ||
echoTest(ok?: (value: string) => void, error?: (msg: string) => void): void; | ||
} | ||
} | ||
|