File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
packages/firebase/useRTDB Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { ref } from 'vue-demi'
5
5
import { tryOnScopeDispose } from '@vueuse/shared'
6
6
7
7
export interface UseRTDBOptions {
8
+ errorHandler ?: ( err : Error ) => void
8
9
autoDispose ?: boolean
9
10
}
10
11
@@ -18,6 +19,7 @@ export function useRTDB<T = any>(
18
19
options : UseRTDBOptions = { } ,
19
20
) {
20
21
const {
22
+ errorHandler = ( err : Error ) => console . error ( err ) ,
21
23
autoDispose = true ,
22
24
} = options
23
25
const data = ref ( undefined ) as Ref < T | undefined >
@@ -26,7 +28,7 @@ export function useRTDB<T = any>(
26
28
data . value = snapshot . val ( )
27
29
}
28
30
29
- const off = onValue ( docRef , update )
31
+ const off = onValue ( docRef , update , errorHandler )
30
32
31
33
if ( autoDispose )
32
34
tryOnScopeDispose ( ( ) => off ( ) )
You can’t perform that action at this time.
0 commit comments