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

Method push

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

Source from the content-addressed store, hash-verified

406 }
407
408 push(value?: any, onComplete?: () => void): ThenableReference {
409 const id = this.native.push();
410 const thennablePushRef = Reference.fromNative(id);
411 const pushRef = Reference.fromNative(id);
412 let promise;
413 if (value) {
414 promise = thennablePushRef.set(value, onComplete).then(() => pushRef);
415 } else {
416 promise = Promise.resolve(pushRef);
417 }
418
419 // @ts-ignore
420 thennablePushRef.then = promise.then.bind(promise);
421 // @ts-ignore
422 thennablePushRef.catch = promise.then.bind(promise, undefined);
423
424 if (typeof onComplete === 'function') {
425 promise.catch(() => {});
426 }
427
428 return thennablePushRef as any;
429 }
430
431 remove(onComplete?: (error: FirebaseError) => void): Promise<void> {
432 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls 4

pushMethod · 0.65
setMethod · 0.65
fromNativeMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected