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

Method push

packages/firebase-database/index.ios.ts:393–414  ·  view source on GitHub ↗
(value?: any, onComplete?: () => void)

Source from the content-addressed store, hash-verified

391 }
392
393 push(value?: any, onComplete?: () => void): ThenableReference {
394 const id = this.native.childByAutoId();
395 const thennablePushRef = Reference.fromNative(id);
396 const pushRef = Reference.fromNative(id);
397 let promise;
398 if (value) {
399 promise = thennablePushRef.set(serialize(value), onComplete).then(() => pushRef);
400 } else {
401 promise = Promise.resolve(pushRef);
402 }
403
404 // @ts-ignore
405 thennablePushRef.then = promise.then.bind(promise);
406 // @ts-ignore
407 thennablePushRef.catch = promise.then.bind(promise, undefined);
408
409 if (typeof onComplete === 'function') {
410 promise.catch(() => {});
411 }
412
413 return thennablePushRef as ThenableReference;
414 }
415
416 remove(onComplete?: (error: FirebaseError) => void): Promise<void> {
417 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls 4

serializeFunction · 0.70
setMethod · 0.65
fromNativeMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected