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

Method transaction

packages/firebase-database/index.ios.ts:480–505  ·  view source on GitHub ↗
(transactionUpdate: (currentData: object) => object, onComplete?: (error: FirebaseError, committed: boolean, finalResult: any) => void, applyLocally?: boolean)

Source from the content-addressed store, hash-verified

478 }
479
480 transaction(transactionUpdate: (currentData: object) => object, onComplete?: (error: FirebaseError, committed: boolean, finalResult: any) => void, applyLocally?: boolean): Promise<any> {
481 return new Promise((resolve, reject) => {
482 this.native.runTransactionBlockAndCompletionBlockWithLocalEvents(
483 (data) => {
484 const newData = transactionUpdate(deserialize(data.value));
485 data.value = serializeItems(newData);
486 return FIRTransactionResult.successWithValue(data);
487 },
488 (error, commited, snapshot) => {
489 if (error) {
490 const err = FirebaseError.fromNative(error);
491 onComplete?.(err, commited, null);
492 reject(err);
493 } else {
494 const ss = DataSnapshot.fromNative(snapshot);
495 onComplete?.(null, commited, ss);
496 resolve({
497 commited,
498 snapshot: ss,
499 });
500 }
501 },
502 applyLocally || true
503 );
504 });
505 }
506
507 update(values: { [key: string]: any }, onComplete?: (error: FirebaseError) => void): Promise<void> {
508 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls 3

deserializeFunction · 0.90
serializeItemsFunction · 0.70
fromNativeMethod · 0.45

Tested by

no test coverage detected