@vueuse/firebase 6.4.1 → 6.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +68 -81
- package/index.iife.js +69 -82
- package/index.iife.min.js +1 -1
- package/index.mjs +68 -81
- package/package.json +3 -3
- package/useAuth.cjs +13 -13
- package/useAuth.iife.js +14 -14
- package/useAuth.iife.min.js +1 -1
- package/useAuth.mjs +13 -13
- package/useFirestore.cjs +40 -49
- package/useFirestore.iife.js +41 -50
- package/useFirestore.iife.min.js +1 -1
- package/useFirestore.mjs +40 -49
- package/useRTDB.cjs +15 -19
- package/useRTDB.iife.js +16 -20
- package/useRTDB.iife.min.js +1 -1
- package/useRTDB.mjs +15 -19
package/index.cjs
CHANGED
|
@@ -5,91 +5,78 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
6
|
var shared = require('@vueuse/shared');
|
|
7
7
|
|
|
8
|
-
function useAuth(authInstance) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
function useAuth(authInstance) {
|
|
9
|
+
let auth;
|
|
10
|
+
if (authInstance instanceof Function)
|
|
11
|
+
auth = authInstance();
|
|
12
|
+
else
|
|
13
|
+
auth = authInstance;
|
|
14
|
+
const user = vueDemi.ref(auth.currentUser);
|
|
15
|
+
const isAuthenticated = vueDemi.computed(() => !!user.value);
|
|
16
|
+
auth.onIdTokenChanged((authUser) => user.value = authUser);
|
|
17
|
+
return {
|
|
18
|
+
isAuthenticated,
|
|
19
|
+
user
|
|
20
|
+
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function getData(docRef) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
function isDocumentReference(docRef) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
64
|
-
}, errorHandler);
|
|
65
|
-
if (autoDispose) {
|
|
66
|
-
shared.tryOnScopeDispose(() => {
|
|
67
|
-
close();
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return data;
|
|
71
|
-
}
|
|
23
|
+
function getData(docRef) {
|
|
24
|
+
const data = docRef.data();
|
|
25
|
+
if (data) {
|
|
26
|
+
Object.defineProperty(data, "id", {
|
|
27
|
+
value: docRef.id.toString(),
|
|
28
|
+
writable: false
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
function isDocumentReference(docRef) {
|
|
34
|
+
var _a;
|
|
35
|
+
return (((_a = docRef.path) == null ? void 0 : _a.match(/\//g)) || []).length % 2 !== 0;
|
|
36
|
+
}
|
|
37
|
+
function useFirestore(docRef, initialValue = void 0, options = {}) {
|
|
38
|
+
const {
|
|
39
|
+
errorHandler = (err) => console.error(err),
|
|
40
|
+
autoDispose = true
|
|
41
|
+
} = options;
|
|
42
|
+
if (isDocumentReference(docRef)) {
|
|
43
|
+
const data = vueDemi.ref(initialValue);
|
|
44
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
45
|
+
data.value = getData(snapshot) || null;
|
|
46
|
+
}, errorHandler);
|
|
47
|
+
shared.tryOnScopeDispose(() => {
|
|
48
|
+
close();
|
|
49
|
+
});
|
|
50
|
+
return data;
|
|
51
|
+
} else {
|
|
52
|
+
const data = vueDemi.ref(initialValue);
|
|
53
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
54
|
+
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
55
|
+
}, errorHandler);
|
|
56
|
+
if (autoDispose) {
|
|
57
|
+
shared.tryOnScopeDispose(() => {
|
|
58
|
+
close();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
72
63
|
}
|
|
73
64
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
docRef.off('value', update);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return data;
|
|
65
|
+
function useRTDB(docRef, options = {}) {
|
|
66
|
+
const {
|
|
67
|
+
autoDispose = true
|
|
68
|
+
} = options;
|
|
69
|
+
const data = vueDemi.ref(void 0);
|
|
70
|
+
function update(snapshot) {
|
|
71
|
+
data.value = snapshot.val();
|
|
72
|
+
}
|
|
73
|
+
docRef.on("value", update);
|
|
74
|
+
if (autoDispose) {
|
|
75
|
+
shared.tryOnScopeDispose(() => {
|
|
76
|
+
docRef.off("value", update);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return data;
|
|
93
80
|
}
|
|
94
81
|
|
|
95
82
|
exports.useAuth = useAuth;
|
package/index.iife.js
CHANGED
|
@@ -62,91 +62,78 @@
|
|
|
62
62
|
;(function (exports, vueDemi, shared) {
|
|
63
63
|
'use strict';
|
|
64
64
|
|
|
65
|
-
function useAuth(authInstance) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
function useAuth(authInstance) {
|
|
66
|
+
let auth;
|
|
67
|
+
if (authInstance instanceof Function)
|
|
68
|
+
auth = authInstance();
|
|
69
|
+
else
|
|
70
|
+
auth = authInstance;
|
|
71
|
+
const user = vueDemi.ref(auth.currentUser);
|
|
72
|
+
const isAuthenticated = vueDemi.computed(() => !!user.value);
|
|
73
|
+
auth.onIdTokenChanged((authUser) => user.value = authUser);
|
|
74
|
+
return {
|
|
75
|
+
isAuthenticated,
|
|
76
|
+
user
|
|
77
|
+
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function getData(docRef) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
function isDocumentReference(docRef) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
121
|
-
}, errorHandler);
|
|
122
|
-
if (autoDispose) {
|
|
123
|
-
shared.tryOnScopeDispose(() => {
|
|
124
|
-
close();
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
return data;
|
|
128
|
-
}
|
|
80
|
+
function getData(docRef) {
|
|
81
|
+
const data = docRef.data();
|
|
82
|
+
if (data) {
|
|
83
|
+
Object.defineProperty(data, "id", {
|
|
84
|
+
value: docRef.id.toString(),
|
|
85
|
+
writable: false
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return data;
|
|
89
|
+
}
|
|
90
|
+
function isDocumentReference(docRef) {
|
|
91
|
+
var _a;
|
|
92
|
+
return (((_a = docRef.path) == null ? void 0 : _a.match(/\//g)) || []).length % 2 !== 0;
|
|
93
|
+
}
|
|
94
|
+
function useFirestore(docRef, initialValue = void 0, options = {}) {
|
|
95
|
+
const {
|
|
96
|
+
errorHandler = (err) => console.error(err),
|
|
97
|
+
autoDispose = true
|
|
98
|
+
} = options;
|
|
99
|
+
if (isDocumentReference(docRef)) {
|
|
100
|
+
const data = vueDemi.ref(initialValue);
|
|
101
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
102
|
+
data.value = getData(snapshot) || null;
|
|
103
|
+
}, errorHandler);
|
|
104
|
+
shared.tryOnScopeDispose(() => {
|
|
105
|
+
close();
|
|
106
|
+
});
|
|
107
|
+
return data;
|
|
108
|
+
} else {
|
|
109
|
+
const data = vueDemi.ref(initialValue);
|
|
110
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
111
|
+
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
112
|
+
}, errorHandler);
|
|
113
|
+
if (autoDispose) {
|
|
114
|
+
shared.tryOnScopeDispose(() => {
|
|
115
|
+
close();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return data;
|
|
119
|
+
}
|
|
129
120
|
}
|
|
130
121
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
docRef.off('value', update);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
return data;
|
|
122
|
+
function useRTDB(docRef, options = {}) {
|
|
123
|
+
const {
|
|
124
|
+
autoDispose = true
|
|
125
|
+
} = options;
|
|
126
|
+
const data = vueDemi.ref(void 0);
|
|
127
|
+
function update(snapshot) {
|
|
128
|
+
data.value = snapshot.val();
|
|
129
|
+
}
|
|
130
|
+
docRef.on("value", update);
|
|
131
|
+
if (autoDispose) {
|
|
132
|
+
shared.tryOnScopeDispose(() => {
|
|
133
|
+
docRef.off("value", update);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return data;
|
|
150
137
|
}
|
|
151
138
|
|
|
152
139
|
exports.useAuth = useAuth;
|
|
@@ -155,4 +142,4 @@
|
|
|
155
142
|
|
|
156
143
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
157
144
|
|
|
158
|
-
}(this.VueUse = this.VueUse || {}, VueDemi, VueUse)
|
|
145
|
+
})(this.VueUse = this.VueUse || {}, VueDemi, VueUse);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(s){if(!s.VueDemi){var e={},n=s.Vue;if(n)if(n.version.slice(0,2)==="2."){var d=s.VueCompositionAPI;if(d){for(var t in d)e[t]=d[t];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if(n.version.slice(0,2)==="3."){for(var t in n)e[t]=n[t];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(u,c,a){return Array.isArray(u)?(u.length=Math.max(u.length,c),u.splice(c,1,a),a):(u[c]=a,a)},e.del=function(u,c){if(Array.isArray(u)){u.splice(c,1);return}delete u[c]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");s.VueDemi=e}})(window),function(s,e,n){"use strict";function d(r){let o;r instanceof Function?o=r():o=r;const l=e.ref(o.currentUser),f=e.computed(()=>!!l.value);return o.onIdTokenChanged(v=>l.value=v),{isAuthenticated:f,user:l}}function t(r){const o=r.data();return o&&Object.defineProperty(o,"id",{value:r.id.toString(),writable:!1}),o}function u(r){var o;return(((o=r.path)==null?void 0:o.match(/\//g))||[]).length%2!=0}function c(r,o=void 0,l={}){const{errorHandler:f=i=>console.error(i),autoDispose:v=!0}=l;if(u(r)){const i=e.ref(o),p=r.onSnapshot(V=>{i.value=t(V)||null},f);return n.tryOnScopeDispose(()=>{p()}),i}else{const i=e.ref(o),p=r.onSnapshot(V=>{i.value=V.docs.map(t).filter(n.isDef)},f);return v&&n.tryOnScopeDispose(()=>{p()}),i}}function a(r,o={}){const{autoDispose:l=!0}=o,f=e.ref(void 0);function v(i){f.value=i.val()}return r.on("value",v),l&&n.tryOnScopeDispose(()=>{r.off("value",v)}),f}s.useAuth=d,s.useFirestore=c,s.useRTDB=a,Object.defineProperty(s,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,VueUse);
|
package/index.mjs
CHANGED
|
@@ -1,91 +1,78 @@
|
|
|
1
1
|
import { ref, computed } from 'vue-demi';
|
|
2
2
|
import { tryOnScopeDispose, isDef } from '@vueuse/shared';
|
|
3
3
|
|
|
4
|
-
function useAuth(authInstance) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
function useAuth(authInstance) {
|
|
5
|
+
let auth;
|
|
6
|
+
if (authInstance instanceof Function)
|
|
7
|
+
auth = authInstance();
|
|
8
|
+
else
|
|
9
|
+
auth = authInstance;
|
|
10
|
+
const user = ref(auth.currentUser);
|
|
11
|
+
const isAuthenticated = computed(() => !!user.value);
|
|
12
|
+
auth.onIdTokenChanged((authUser) => user.value = authUser);
|
|
13
|
+
return {
|
|
14
|
+
isAuthenticated,
|
|
15
|
+
user
|
|
16
|
+
};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function getData(docRef) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
function isDocumentReference(docRef) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
data.value = snapshot.docs.map(getData).filter(isDef);
|
|
60
|
-
}, errorHandler);
|
|
61
|
-
if (autoDispose) {
|
|
62
|
-
tryOnScopeDispose(() => {
|
|
63
|
-
close();
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return data;
|
|
67
|
-
}
|
|
19
|
+
function getData(docRef) {
|
|
20
|
+
const data = docRef.data();
|
|
21
|
+
if (data) {
|
|
22
|
+
Object.defineProperty(data, "id", {
|
|
23
|
+
value: docRef.id.toString(),
|
|
24
|
+
writable: false
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function isDocumentReference(docRef) {
|
|
30
|
+
var _a;
|
|
31
|
+
return (((_a = docRef.path) == null ? void 0 : _a.match(/\//g)) || []).length % 2 !== 0;
|
|
32
|
+
}
|
|
33
|
+
function useFirestore(docRef, initialValue = void 0, options = {}) {
|
|
34
|
+
const {
|
|
35
|
+
errorHandler = (err) => console.error(err),
|
|
36
|
+
autoDispose = true
|
|
37
|
+
} = options;
|
|
38
|
+
if (isDocumentReference(docRef)) {
|
|
39
|
+
const data = ref(initialValue);
|
|
40
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
41
|
+
data.value = getData(snapshot) || null;
|
|
42
|
+
}, errorHandler);
|
|
43
|
+
tryOnScopeDispose(() => {
|
|
44
|
+
close();
|
|
45
|
+
});
|
|
46
|
+
return data;
|
|
47
|
+
} else {
|
|
48
|
+
const data = ref(initialValue);
|
|
49
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
50
|
+
data.value = snapshot.docs.map(getData).filter(isDef);
|
|
51
|
+
}, errorHandler);
|
|
52
|
+
if (autoDispose) {
|
|
53
|
+
tryOnScopeDispose(() => {
|
|
54
|
+
close();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
68
59
|
}
|
|
69
60
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
docRef.off('value', update);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return data;
|
|
61
|
+
function useRTDB(docRef, options = {}) {
|
|
62
|
+
const {
|
|
63
|
+
autoDispose = true
|
|
64
|
+
} = options;
|
|
65
|
+
const data = ref(void 0);
|
|
66
|
+
function update(snapshot) {
|
|
67
|
+
data.value = snapshot.val();
|
|
68
|
+
}
|
|
69
|
+
docRef.on("value", update);
|
|
70
|
+
if (autoDispose) {
|
|
71
|
+
tryOnScopeDispose(() => {
|
|
72
|
+
docRef.off("value", update);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return data;
|
|
89
76
|
}
|
|
90
77
|
|
|
91
78
|
export { useAuth, useFirestore, useRTDB };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/firebase",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.3",
|
|
4
4
|
"description": "Enables realtime bindings for Firebase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"url": "git+https://github.com/vueuse/vueuse.git"
|
|
16
16
|
},
|
|
17
17
|
"funding": "https://github.com/sponsors/antfu",
|
|
18
|
-
"author": "Anthony Fu<https://github.com/antfu>",
|
|
18
|
+
"author": "Anthony Fu <https://github.com/antfu>",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"import": "./index.mjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"firebase": ">=4.0.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@vueuse/shared": "6.
|
|
52
|
+
"@vueuse/shared": "6.5.3",
|
|
53
53
|
"vue-demi": "*"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/useAuth.cjs
CHANGED
|
@@ -4,19 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
6
|
|
|
7
|
-
function useAuth(authInstance) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
function useAuth(authInstance) {
|
|
8
|
+
let auth;
|
|
9
|
+
if (authInstance instanceof Function)
|
|
10
|
+
auth = authInstance();
|
|
11
|
+
else
|
|
12
|
+
auth = authInstance;
|
|
13
|
+
const user = vueDemi.ref(auth.currentUser);
|
|
14
|
+
const isAuthenticated = vueDemi.computed(() => !!user.value);
|
|
15
|
+
auth.onIdTokenChanged((authUser) => user.value = authUser);
|
|
16
|
+
return {
|
|
17
|
+
isAuthenticated,
|
|
18
|
+
user
|
|
19
|
+
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
exports.useAuth = useAuth;
|
package/useAuth.iife.js
CHANGED
|
@@ -62,23 +62,23 @@
|
|
|
62
62
|
;(function (exports, vueDemi) {
|
|
63
63
|
'use strict';
|
|
64
64
|
|
|
65
|
-
function useAuth(authInstance) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
function useAuth(authInstance) {
|
|
66
|
+
let auth;
|
|
67
|
+
if (authInstance instanceof Function)
|
|
68
|
+
auth = authInstance();
|
|
69
|
+
else
|
|
70
|
+
auth = authInstance;
|
|
71
|
+
const user = vueDemi.ref(auth.currentUser);
|
|
72
|
+
const isAuthenticated = vueDemi.computed(() => !!user.value);
|
|
73
|
+
auth.onIdTokenChanged((authUser) => user.value = authUser);
|
|
74
|
+
return {
|
|
75
|
+
isAuthenticated,
|
|
76
|
+
user
|
|
77
|
+
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
exports.useAuth = useAuth;
|
|
81
81
|
|
|
82
82
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
83
83
|
|
|
84
|
-
}(this.VueUse = this.VueUse || {}, VueDemi)
|
|
84
|
+
})(this.VueUse = this.VueUse || {}, VueDemi);
|
package/useAuth.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(s){if(!s.VueDemi){var e={},i=s.Vue;if(i)if(i.version.slice(0,2)==="2."){var o=s.VueCompositionAPI;if(o){for(var n in o)e[n]=o[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=i,e.Vue2=i,e.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if(i.version.slice(0,2)==="3."){for(var n in i)e[n]=i[n];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=i,e.Vue2=void 0,e.version=i.version,e.set=function(u,r,t){return Array.isArray(u)?(u.length=Math.max(u.length,r),u.splice(r,1,t),t):(u[r]=t,t)},e.del=function(u,r){if(Array.isArray(u)){u.splice(r,1);return}delete u[r]}}else console.error("[vue-demi] Vue version "+i.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");s.VueDemi=e}})(window),function(s,e){"use strict";function i(o){let n;o instanceof Function?n=o():n=o;const u=e.ref(n.currentUser),r=e.computed(()=>!!u.value);return n.onIdTokenChanged(t=>u.value=t),{isAuthenticated:r,user:u}}s.useAuth=i,Object.defineProperty(s,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi);
|
package/useAuth.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ref, computed } from 'vue-demi';
|
|
2
2
|
|
|
3
|
-
function useAuth(authInstance) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
function useAuth(authInstance) {
|
|
4
|
+
let auth;
|
|
5
|
+
if (authInstance instanceof Function)
|
|
6
|
+
auth = authInstance();
|
|
7
|
+
else
|
|
8
|
+
auth = authInstance;
|
|
9
|
+
const user = ref(auth.currentUser);
|
|
10
|
+
const isAuthenticated = computed(() => !!user.value);
|
|
11
|
+
auth.onIdTokenChanged((authUser) => user.value = authUser);
|
|
12
|
+
return {
|
|
13
|
+
isAuthenticated,
|
|
14
|
+
user
|
|
15
|
+
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { useAuth };
|
package/useFirestore.cjs
CHANGED
|
@@ -5,55 +5,46 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
6
|
var shared = require('@vueuse/shared');
|
|
7
7
|
|
|
8
|
-
function getData(docRef) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
function isDocumentReference(docRef) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
49
|
-
}, errorHandler);
|
|
50
|
-
if (autoDispose) {
|
|
51
|
-
shared.tryOnScopeDispose(() => {
|
|
52
|
-
close();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
8
|
+
function getData(docRef) {
|
|
9
|
+
const data = docRef.data();
|
|
10
|
+
if (data) {
|
|
11
|
+
Object.defineProperty(data, "id", {
|
|
12
|
+
value: docRef.id.toString(),
|
|
13
|
+
writable: false
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
function isDocumentReference(docRef) {
|
|
19
|
+
var _a;
|
|
20
|
+
return (((_a = docRef.path) == null ? void 0 : _a.match(/\//g)) || []).length % 2 !== 0;
|
|
21
|
+
}
|
|
22
|
+
function useFirestore(docRef, initialValue = void 0, options = {}) {
|
|
23
|
+
const {
|
|
24
|
+
errorHandler = (err) => console.error(err),
|
|
25
|
+
autoDispose = true
|
|
26
|
+
} = options;
|
|
27
|
+
if (isDocumentReference(docRef)) {
|
|
28
|
+
const data = vueDemi.ref(initialValue);
|
|
29
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
30
|
+
data.value = getData(snapshot) || null;
|
|
31
|
+
}, errorHandler);
|
|
32
|
+
shared.tryOnScopeDispose(() => {
|
|
33
|
+
close();
|
|
34
|
+
});
|
|
35
|
+
return data;
|
|
36
|
+
} else {
|
|
37
|
+
const data = vueDemi.ref(initialValue);
|
|
38
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
39
|
+
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
40
|
+
}, errorHandler);
|
|
41
|
+
if (autoDispose) {
|
|
42
|
+
shared.tryOnScopeDispose(() => {
|
|
43
|
+
close();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
57
48
|
}
|
|
58
49
|
|
|
59
50
|
exports.useFirestore = useFirestore;
|
package/useFirestore.iife.js
CHANGED
|
@@ -62,59 +62,50 @@
|
|
|
62
62
|
;(function (exports, vueDemi, shared) {
|
|
63
63
|
'use strict';
|
|
64
64
|
|
|
65
|
-
function getData(docRef) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
function isDocumentReference(docRef) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
106
|
-
}, errorHandler);
|
|
107
|
-
if (autoDispose) {
|
|
108
|
-
shared.tryOnScopeDispose(() => {
|
|
109
|
-
close();
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return data;
|
|
113
|
-
}
|
|
65
|
+
function getData(docRef) {
|
|
66
|
+
const data = docRef.data();
|
|
67
|
+
if (data) {
|
|
68
|
+
Object.defineProperty(data, "id", {
|
|
69
|
+
value: docRef.id.toString(),
|
|
70
|
+
writable: false
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
75
|
+
function isDocumentReference(docRef) {
|
|
76
|
+
var _a;
|
|
77
|
+
return (((_a = docRef.path) == null ? void 0 : _a.match(/\//g)) || []).length % 2 !== 0;
|
|
78
|
+
}
|
|
79
|
+
function useFirestore(docRef, initialValue = void 0, options = {}) {
|
|
80
|
+
const {
|
|
81
|
+
errorHandler = (err) => console.error(err),
|
|
82
|
+
autoDispose = true
|
|
83
|
+
} = options;
|
|
84
|
+
if (isDocumentReference(docRef)) {
|
|
85
|
+
const data = vueDemi.ref(initialValue);
|
|
86
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
87
|
+
data.value = getData(snapshot) || null;
|
|
88
|
+
}, errorHandler);
|
|
89
|
+
shared.tryOnScopeDispose(() => {
|
|
90
|
+
close();
|
|
91
|
+
});
|
|
92
|
+
return data;
|
|
93
|
+
} else {
|
|
94
|
+
const data = vueDemi.ref(initialValue);
|
|
95
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
96
|
+
data.value = snapshot.docs.map(getData).filter(shared.isDef);
|
|
97
|
+
}, errorHandler);
|
|
98
|
+
if (autoDispose) {
|
|
99
|
+
shared.tryOnScopeDispose(() => {
|
|
100
|
+
close();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
114
105
|
}
|
|
115
106
|
|
|
116
107
|
exports.useFirestore = useFirestore;
|
|
117
108
|
|
|
118
109
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
119
110
|
|
|
120
|
-
}(this.VueUse = this.VueUse || {}, VueDemi, VueUse)
|
|
111
|
+
})(this.VueUse = this.VueUse || {}, VueDemi, VueUse);
|
package/useFirestore.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(o){if(!o.VueDemi){var e={},r=o.Vue;if(r)if(r.version.slice(0,2)==="2."){var l=o.VueCompositionAPI;if(l){for(var u in l)e[u]=l[u];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=r,e.Vue2=r,e.version=r.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if(r.version.slice(0,2)==="3."){for(var u in r)e[u]=r[u];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=r,e.Vue2=void 0,e.version=r.version,e.set=function(s,n,i){return Array.isArray(s)?(s.length=Math.max(s.length,n),s.splice(n,1,i),i):(s[n]=i,i)},e.del=function(s,n){if(Array.isArray(s)){s.splice(n,1);return}delete s[n]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");o.VueDemi=e}})(window),function(o,e,r){"use strict";function l(n){const i=n.data();return i&&Object.defineProperty(i,"id",{value:n.id.toString(),writable:!1}),i}function u(n){var i;return(((i=n.path)==null?void 0:i.match(/\//g))||[]).length%2!=0}function s(n,i=void 0,v={}){const{errorHandler:a=t=>console.error(t),autoDispose:p=!0}=v;if(u(n)){const t=e.ref(i),c=n.onSnapshot(f=>{t.value=l(f)||null},a);return r.tryOnScopeDispose(()=>{c()}),t}else{const t=e.ref(i),c=n.onSnapshot(f=>{t.value=f.docs.map(l).filter(r.isDef)},a);return p&&r.tryOnScopeDispose(()=>{c()}),t}}o.useFirestore=s,Object.defineProperty(o,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,VueUse);
|
package/useFirestore.mjs
CHANGED
|
@@ -1,55 +1,46 @@
|
|
|
1
1
|
import { ref } from 'vue-demi';
|
|
2
2
|
import { tryOnScopeDispose, isDef } from '@vueuse/shared';
|
|
3
3
|
|
|
4
|
-
function getData(docRef) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
function isDocumentReference(docRef) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
data.value = snapshot.docs.map(getData).filter(isDef);
|
|
45
|
-
}, errorHandler);
|
|
46
|
-
if (autoDispose) {
|
|
47
|
-
tryOnScopeDispose(() => {
|
|
48
|
-
close();
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
4
|
+
function getData(docRef) {
|
|
5
|
+
const data = docRef.data();
|
|
6
|
+
if (data) {
|
|
7
|
+
Object.defineProperty(data, "id", {
|
|
8
|
+
value: docRef.id.toString(),
|
|
9
|
+
writable: false
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function isDocumentReference(docRef) {
|
|
15
|
+
var _a;
|
|
16
|
+
return (((_a = docRef.path) == null ? void 0 : _a.match(/\//g)) || []).length % 2 !== 0;
|
|
17
|
+
}
|
|
18
|
+
function useFirestore(docRef, initialValue = void 0, options = {}) {
|
|
19
|
+
const {
|
|
20
|
+
errorHandler = (err) => console.error(err),
|
|
21
|
+
autoDispose = true
|
|
22
|
+
} = options;
|
|
23
|
+
if (isDocumentReference(docRef)) {
|
|
24
|
+
const data = ref(initialValue);
|
|
25
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
26
|
+
data.value = getData(snapshot) || null;
|
|
27
|
+
}, errorHandler);
|
|
28
|
+
tryOnScopeDispose(() => {
|
|
29
|
+
close();
|
|
30
|
+
});
|
|
31
|
+
return data;
|
|
32
|
+
} else {
|
|
33
|
+
const data = ref(initialValue);
|
|
34
|
+
const close = docRef.onSnapshot((snapshot) => {
|
|
35
|
+
data.value = snapshot.docs.map(getData).filter(isDef);
|
|
36
|
+
}, errorHandler);
|
|
37
|
+
if (autoDispose) {
|
|
38
|
+
tryOnScopeDispose(() => {
|
|
39
|
+
close();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
53
44
|
}
|
|
54
45
|
|
|
55
46
|
export { useFirestore };
|
package/useRTDB.cjs
CHANGED
|
@@ -5,25 +5,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
6
|
var shared = require('@vueuse/shared');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
docRef.off('value', update);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return data;
|
|
8
|
+
function useRTDB(docRef, options = {}) {
|
|
9
|
+
const {
|
|
10
|
+
autoDispose = true
|
|
11
|
+
} = options;
|
|
12
|
+
const data = vueDemi.ref(void 0);
|
|
13
|
+
function update(snapshot) {
|
|
14
|
+
data.value = snapshot.val();
|
|
15
|
+
}
|
|
16
|
+
docRef.on("value", update);
|
|
17
|
+
if (autoDispose) {
|
|
18
|
+
shared.tryOnScopeDispose(() => {
|
|
19
|
+
docRef.off("value", update);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return data;
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
exports.useRTDB = useRTDB;
|
package/useRTDB.iife.js
CHANGED
|
@@ -62,29 +62,25 @@
|
|
|
62
62
|
;(function (exports, vueDemi, shared) {
|
|
63
63
|
'use strict';
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
docRef.off('value', update);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return data;
|
|
65
|
+
function useRTDB(docRef, options = {}) {
|
|
66
|
+
const {
|
|
67
|
+
autoDispose = true
|
|
68
|
+
} = options;
|
|
69
|
+
const data = vueDemi.ref(void 0);
|
|
70
|
+
function update(snapshot) {
|
|
71
|
+
data.value = snapshot.val();
|
|
72
|
+
}
|
|
73
|
+
docRef.on("value", update);
|
|
74
|
+
if (autoDispose) {
|
|
75
|
+
shared.tryOnScopeDispose(() => {
|
|
76
|
+
docRef.off("value", update);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return data;
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
exports.useRTDB = useRTDB;
|
|
87
83
|
|
|
88
84
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
89
85
|
|
|
90
|
-
}(this.VueUse = this.VueUse || {}, VueDemi, VueUse)
|
|
86
|
+
})(this.VueUse = this.VueUse || {}, VueDemi, VueUse);
|
package/useRTDB.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(r){if(!r.VueDemi){var e={},i=r.Vue;if(i)if(i.version.slice(0,2)==="2."){var t=r.VueCompositionAPI;if(t){for(var s in t)e[s]=t[s];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=i,e.Vue2=i,e.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if(i.version.slice(0,2)==="3."){for(var s in i)e[s]=i[s];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=i,e.Vue2=void 0,e.version=i.version,e.set=function(u,n,o){return Array.isArray(u)?(u.length=Math.max(u.length,n),u.splice(n,1,o),o):(u[n]=o,o)},e.del=function(u,n){if(Array.isArray(u)){u.splice(n,1);return}delete u[n]}}else console.error("[vue-demi] Vue version "+i.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");r.VueDemi=e}})(window),function(r,e,i){"use strict";function t(s,u={}){const{autoDispose:n=!0}=u,o=e.ref(void 0);function f(l){o.value=l.val()}return s.on("value",f),n&&i.tryOnScopeDispose(()=>{s.off("value",f)}),o}r.useRTDB=t,Object.defineProperty(r,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,VueUse);
|
package/useRTDB.mjs
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { ref } from 'vue-demi';
|
|
2
2
|
import { tryOnScopeDispose } from '@vueuse/shared';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
docRef.off('value', update);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return data;
|
|
4
|
+
function useRTDB(docRef, options = {}) {
|
|
5
|
+
const {
|
|
6
|
+
autoDispose = true
|
|
7
|
+
} = options;
|
|
8
|
+
const data = ref(void 0);
|
|
9
|
+
function update(snapshot) {
|
|
10
|
+
data.value = snapshot.val();
|
|
11
|
+
}
|
|
12
|
+
docRef.on("value", update);
|
|
13
|
+
if (autoDispose) {
|
|
14
|
+
tryOnScopeDispose(() => {
|
|
15
|
+
docRef.off("value", update);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return data;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
export { useRTDB };
|