Skip to content

Commit 598d4aa

Browse files
committed
refactor: reorganize deps optionsAPI
1 parent ef6eb73 commit 598d4aa

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

src/database/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
import { useFirebaseApp } from '../app'
1111
import { UseDatabaseRefOptions, _useDatabaseRef } from './useDatabaseRef'
1212

13-
export { databasePlugin } from './optionsApi'
1413
export { globalDatabaseOptions } from './bind'
1514
export type { UseDatabaseRefOptions }
1615

src/database/optionsApi.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { isVue3 } from 'vue-demi'
55
import { useFirebaseApp } from '../app'
66
import { getGlobalScope } from '../globals'
77
import { ResetOption, UnbindWithReset } from '../shared'
8-
import { internalUnbind } from './unbind'
8+
import { databaseUnbinds, internalUnbind } from './unbind'
99
import { _DatabaseRefOptions } from './bind'
1010
import { _useDatabaseRef } from './useDatabaseRef'
1111

@@ -34,11 +34,6 @@ const databasePluginDefaults: Readonly<
3434
export type VueFirebaseObject = Record<string, Query | DatabaseReference>
3535
export type FirebaseOption = VueFirebaseObject | (() => VueFirebaseObject)
3636

37-
export const databaseUnbinds = new WeakMap<
38-
object,
39-
Record<string, UnbindWithReset>
40-
>()
41-
4237
/**
4338
* Install this plugin if you want to add `$databaseBind` and `$databaseUnbind` functions. Note this plugin is only necessary if
4439
* you use the Options API. If you **exclusively use the Composition API** (e.g. `useDatabaseObject()` and `useDatabaseList()`), you

src/database/unbind.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import type { Ref } from 'vue-demi'
22
import type { UnbindWithReset, ResetOption } from '../shared'
3-
import { databaseUnbinds } from './optionsApi'
3+
4+
export const databaseUnbinds = new WeakMap<
5+
object,
6+
Record<string, UnbindWithReset>
7+
>()
48

59
export function internalUnbind(
610
key: string,

src/firestore/optionsApi.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,13 @@ import { ResetOption, UnbindWithReset, _FirestoreDataSource } from '../shared'
1717
import { FirebaseApp } from 'firebase/app'
1818
import { getGlobalScope } from '../globals'
1919
import { useFirebaseApp } from '../app'
20-
import { internalUnbind } from './unbind'
20+
import { firestoreUnbinds, internalUnbind } from './unbind'
2121

2222
// TODO: this should be an entry point to generate the corresponding .d.ts file that only gets included if the plugin is imported
2323

2424
export type VueFirestoreObject = Record<string, _FirestoreDataSource>
2525
export type FirestoreOption = VueFirestoreObject | (() => VueFirestoreObject)
2626

27-
export const firestoreUnbinds = new WeakMap<
28-
object,
29-
Record<string, UnbindWithReset>
30-
>()
31-
3227
/**
3328
* Options for the Firebase Database Plugin that enables the Options API such as `$firestoreBind` and
3429
* `$firestoreUnbind`.

src/firestore/unbind.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import type { Ref } from 'vue-demi'
22
import type { UnbindWithReset } from '../shared'
33
import type { FirestoreRefOptions } from './bind'
4-
import { firestoreUnbinds } from './optionsApi'
4+
5+
export const firestoreUnbinds = new WeakMap<
6+
object,
7+
Record<string, UnbindWithReset>
8+
>()
59

610
export function internalUnbind(
711
key: string,

0 commit comments

Comments
 (0)