(value?: any, onComplete?: () => void)
| 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) => { |
nothing calls this directly
no test coverage detected