Skip to content

Commit 67fda56

Browse files
committed
build latest
1 parent 4936e1b commit 67fda56

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

Diff for: dist/vuefire.js

+33-9
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,34 @@ return /******/ (function(modules) { // webpackBootstrap
5656

5757
var Vue // late binding
5858

59+
/**
60+
* Returns the key of a Firebase snapshot across SDK versions.
61+
*
62+
* @param {FirebaseSnapshot} snapshot
63+
* @return {string|null}
64+
*/
65+
function _getKey (snapshot) {
66+
return typeof snapshot.key === 'function'
67+
? snapshot.key()
68+
: snapshot.key
69+
}
70+
71+
/**
72+
* Returns the original reference of a Firebase reference or query across SDK versions.
73+
*
74+
* @param {FirebaseReference|FirebaseQuery} refOrQuery
75+
* @return {FirebaseReference}
76+
*/
77+
function _getRef (refOrQuery) {
78+
if (typeof refOrQuery.ref === 'function') {
79+
refOrQuery = refOrQuery.ref()
80+
} else if (typeof refOrQuery.ref === 'object') {
81+
refOrQuery = refOrQuery.ref
82+
}
83+
84+
return refOrQuery
85+
}
86+
5987
/**
6088
* Check if a value is an object.
6189
*
@@ -77,7 +105,7 @@ return /******/ (function(modules) { // webpackBootstrap
77105
var res = isObject(value)
78106
? value
79107
: { '.value': value }
80-
res['.key'] = snapshot.key()
108+
res['.key'] = _getKey(snapshot)
81109
return res
82110
}
83111

@@ -117,11 +145,7 @@ return /******/ (function(modules) { // webpackBootstrap
117145
if (!isObject(source)) {
118146
throw new Error('VueFire: invalid Firebase binding source.')
119147
}
120-
// get the original ref for possible queries
121-
var ref = source
122-
if (typeof source.ref === 'function') {
123-
ref = source.ref()
124-
}
148+
var ref = _getRef(source)
125149
vm.$firebaseRefs[key] = ref
126150
vm._firebaseSources[key] = source
127151
// bind based on initial value type
@@ -150,17 +174,17 @@ return /******/ (function(modules) { // webpackBootstrap
150174
}, cancelCallback)
151175

152176
var onRemove = source.on('child_removed', function (snapshot) {
153-
var index = indexForKey(array, snapshot.key())
177+
var index = indexForKey(array, _getKey(snapshot))
154178
array.splice(index, 1)
155179
}, cancelCallback)
156180

157181
var onChange = source.on('child_changed', function (snapshot) {
158-
var index = indexForKey(array, snapshot.key())
182+
var index = indexForKey(array, _getKey(snapshot))
159183
array.splice(index, 1, createRecord(snapshot))
160184
}, cancelCallback)
161185

162186
var onMove = source.on('child_moved', function (snapshot, prevKey) {
163-
var index = indexForKey(array, snapshot.key())
187+
var index = indexForKey(array, _getKey(snapshot))
164188
var record = array.splice(index, 1)[0]
165189
var newIndex = prevKey ? indexForKey(array, prevKey) + 1 : 0
166190
array.splice(newIndex, 0, record)

Diff for: dist/vuefire.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"dev": "webpack src/vuefire.js dist/vuefire.js --watch",
1515
"build-dev": "webpack src/vuefire.js dist/vuefire.js --output-library=VueFire --output-library-target=umd",
1616
"build-prod": "webpack src/vuefire.js dist/vuefire.min.js --output-library=VueFire --output-library-target=umd -p",
17-
"build": "npm run build-dev && npm run build-prod"
17+
"build": "npm run build-dev && npm run build-prod",
18+
"prepublish": "npm run build"
1819
},
1920
"repository": {
2021
"type": "git",

0 commit comments

Comments
 (0)