| 28 | } |
| 29 | |
| 30 | export class OnDisconnect implements IOnDisconnect { |
| 31 | _native: com.google.firebase.database.OnDisconnect; |
| 32 | static fromNative(disconnect: com.google.firebase.database.OnDisconnect) { |
| 33 | if (disconnect instanceof com.google.firebase.database.OnDisconnect) { |
| 34 | const d = new OnDisconnect(); |
| 35 | d._native = disconnect; |
| 36 | return d; |
| 37 | } |
| 38 | return null; |
| 39 | } |
| 40 | |
| 41 | get native() { |
| 42 | return this._native; |
| 43 | } |
| 44 | |
| 45 | get android() { |
| 46 | return this.native; |
| 47 | } |
| 48 | |
| 49 | cancel(onComplete?: (error: FirebaseError) => void): Promise<void> { |
| 50 | return new Promise((resolve, reject) => { |
| 51 | NSOnDisconnect().cancel( |
| 52 | this.native, |
| 53 | new org.nativescript.firebase.database.FirebaseDatabase.Callback<java.lang.Void>({ |
| 54 | onError(error) { |
| 55 | const err = FirebaseError.fromNative(error); |
| 56 | onComplete?.(err); |
| 57 | reject(err); |
| 58 | }, |
| 59 | onSuccess(value) { |
| 60 | onComplete?.(null); |
| 61 | resolve(); |
| 62 | }, |
| 63 | }) |
| 64 | ); |
| 65 | }); |
| 66 | } |
| 67 | remove(onComplete?: (error: FirebaseError) => void): Promise<void> { |
| 68 | return new Promise((resolve, reject) => { |
| 69 | NSOnDisconnect().remove( |
| 70 | this.native, |
| 71 | new org.nativescript.firebase.database.FirebaseDatabase.Callback<java.lang.Void>({ |
| 72 | onError(error) { |
| 73 | const err = FirebaseError.fromNative(error); |
| 74 | onComplete?.(err); |
| 75 | reject(err); |
| 76 | }, |
| 77 | onSuccess(value) { |
| 78 | onComplete?.(null); |
| 79 | resolve(); |
| 80 | }, |
| 81 | }) |
| 82 | ); |
| 83 | }); |
| 84 | } |
| 85 | set(value: any, onComplete?: (error: FirebaseError) => void): Promise<void> { |
| 86 | return new Promise((resolve, reject) => { |
| 87 | NSOnDisconnect().set( |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…