andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.76k stars 520 forks source link

await db.transaction #442

Open fjqingyou opened 4 years ago

fjqingyou commented 4 years ago
``` TypeScript //db: SQLite.SQLiteDatabase let tx = await db.transaction((tx2 : Transaction)=>{ console.info("tx2=",tx2); }); console.info("tx=",tx); ``` ## Expected Behavior

tx !== null && tx2 == tx

Current Behavior

tx == null && tx2 != null && tx2 != tx

and console print

18:47:10.364 tx2= SQLitePluginTransaction {db: SQLitePlugin, txlock: true, fn: ƒ, error: ƒ, success: ƒ, …} 18:47:19.259 tx= []

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment

Debug logs

fjqingyou commented 4 years ago

441 I need using await, so i can't usin callback mode

andpor commented 3 years ago

@fjqingyou did you turn on Promise mode?