Skip to content

Commit

Permalink
refactor: rename rtdbPlugin to databasePlugin
Browse files Browse the repository at this point in the history
BREAKING CHANGE: rename `rtdbPlugin` to `databasePlugin` in your code
  • Loading branch information
posva committed Oct 20, 2022
1 parent 058d7dc commit a7f500d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/guide/binding-subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ You must declare properties with their initial values in `data`. **For the RTDB,

## Programmatic binding

If you need to change the bound reference while the application is running, e.g. to display a different user profile, or different product detail page, _Declarative binding_ isn't enough. This can be achieved through the `$rtdbBind`/`$bind` methods added by `rtdbPlugin`/`firestorePlugin` in any Vue component.
If you need to change the bound reference while the application is running, e.g. to display a different user profile, or different product detail page, _Declarative binding_ isn't enough. This can be achieved through the `$rtdbBind`/`$bind` methods added by `databasePlugin`/`firestorePlugin` in any Vue component.

<FirebaseExample>

Expand Down
6 changes: 3 additions & 3 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ TODO: usage with plugin and option API
Vuefire must be installed as a Vue plugin. Make sure to install the right one:

- Install `firestorePlugin` if you need to use _Cloud Firestore_ (often abreviated _Firestore_)
- Install `rtdbPlugin` if you need to use the original _RTDB_ (Real Time Database)
- Install `databasePlugin` if you need to use the original _RTDB_ (Real Time Database)
- If you need to use both, check [Using RTDB and Firestore together](../cookbook/rtdb-and-firestore.md)

<FirebaseExample>

```js
import Vue from 'vue'
import { rtdbPlugin } from 'vuefire'
import { databasePlugin } from 'vuefire'

Vue.use(rtdbPlugin)
Vue.use(databasePlugin)
```

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/upgrading-from-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Because we support both _RTDB_ and _Firestore_, there are now named exports inst
```diff
import Vue from 'vue'
- import VueFire from 'vuefire'
+ import { rtdbPlugin as VueFire } from 'vuefire'
+ import { databasePlugin as VueFire } from 'vuefire'

// explicit installation required in module environments
Vue.use(VueFire)
Expand Down
2 changes: 1 addition & 1 deletion src/database/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type { DatabaseReference, DataSnapshot, Query } from 'firebase/database'
import { _RefWithState } from '../shared'
import { rtdbUnbinds } from './optionsApi'

export { rtdbPlugin } from './optionsApi'
export { databasePlugin } from './optionsApi'

const ops: OperationsType = {
set: (target, key, value) => walkSet(target, key, value),
Expand Down
2 changes: 1 addition & 1 deletion src/database/optionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const rtdbUnbinds = new WeakMap<
* @param app
* @param pluginOptions
*/
export function rtdbPlugin(
export function databasePlugin(
app: App,
pluginOptions: DatabasePluginOptions = defaultOptions
) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export {
useObject,
} from './database'

export { rtdbPlugin } from './database/optionsApi'
export { databasePlugin } from './database/optionsApi'
export type { DatabasePluginOptions } from './database/optionsApi'

// TODO: rename and move to database
Expand Down
8 changes: 4 additions & 4 deletions tests/database/options.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineComponent } from 'vue'
import { mount } from '@vue/test-utils'
import { describe, expect, it, vi } from 'vitest'
import { rtdbPlugin, DatabasePluginOptions } from '../../src'
import { databasePlugin, DatabasePluginOptions } from '../../src'
import { setupDatabaseRefs } from '../utils'
import { push } from 'firebase/database'

Expand All @@ -15,7 +15,7 @@ describe('RTDB: plugin options', () => {
global: {
plugins: [
[
rtdbPlugin,
databasePlugin,
{
bindName: '$myBind',
unbindName: '$myUnbind',
Expand All @@ -39,7 +39,7 @@ describe('RTDB: plugin options', () => {
},
{
global: {
plugins: [[rtdbPlugin, pluginOptions]],
plugins: [[databasePlugin, pluginOptions]],
},
}
)
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('RTDB: plugin options', () => {
},
{
global: {
plugins: [[rtdbPlugin, pluginOptions]],
plugins: [[databasePlugin, pluginOptions]],
},
}
)
Expand Down

0 comments on commit a7f500d

Please sign in to comment.