(updateFunction: (transaction: Transaction) => Promise<any>)
| 1419 | } |
| 1420 | |
| 1421 | runTransaction(updateFunction: (transaction: Transaction) => Promise<any>): Promise<any> { |
| 1422 | return new Promise((resolve, reject) => { |
| 1423 | this.native.runTransactionWithBlockCompletion( |
| 1424 | (transaction, error) => { |
| 1425 | const lock = NSLock.new(); |
| 1426 | let returnValue; |
| 1427 | dispatch_async(main_queue, () => { |
| 1428 | updateFunction(Transaction.fromNative(transaction)) |
| 1429 | .then((value) => { |
| 1430 | returnValue = value?.native || value || null; |
| 1431 | }) |
| 1432 | .catch((e) => { |
| 1433 | return null; |
| 1434 | }); |
| 1435 | }); |
| 1436 | lock.lock(); |
| 1437 | }, |
| 1438 | (done, done_error) => { |
| 1439 | if (done_error) { |
| 1440 | reject(FirebaseError.fromNative(done_error)); |
| 1441 | } else { |
| 1442 | resolve(deserializeField(done)); |
| 1443 | } |
| 1444 | } |
| 1445 | ); |
| 1446 | }); |
| 1447 | } |
| 1448 | |
| 1449 | get settings() { |
| 1450 | return Settings.fromNative(this.native?.settings, this.native); |
nothing calls this directly
no test coverage detected