MCPcopy Index your code
hub / github.com/NativeScript/firebase / runTransaction

Method runTransaction

packages/firebase-firestore/index.ios.ts:1421–1447  ·  view source on GitHub ↗
(updateFunction: (transaction: Transaction) => Promise<any>)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 3

deserializeFieldFunction · 0.70
thenMethod · 0.45
fromNativeMethod · 0.45

Tested by

no test coverage detected