Skip to content

Commit

Permalink
Release 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Sep 7, 2016
1 parent 1617cd9 commit 802c224
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
20 changes: 18 additions & 2 deletions dist/vuefire.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ return /******/ (function(modules) { // webpackBootstrap
}
}

/**
* Define a reactive property in a given vm if it's not defined
* yet
*
* @param {Vue} vm
* @param {string} key
* @param {*} val
*/
function defineReactive (vm, key, val) {
if (key in vm) {
vm[key] = val
} else {
Vue.util.defineReactive(vm, key, val)
}
}

/**
* Bind a firebase data source to a key on a vm as an Array.
*
Expand All @@ -166,7 +182,7 @@ return /******/ (function(modules) { // webpackBootstrap
*/
function bindAsArray (vm, key, source, cancelCallback) {
var array = []
Vue.util.defineReactive(vm, key, array)
defineReactive(vm, key, array)

var onAdd = source.on('child_added', function (snapshot, prevKey) {
var index = prevKey ? indexForKey(array, prevKey) + 1 : 0
Expand Down Expand Up @@ -207,7 +223,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {function|null} cancelCallback
*/
function bindAsObject (vm, key, source, cancelCallback) {
Vue.util.defineReactive(vm, key, {})
defineReactive(vm, key, {})
var cb = source.on('value', function (snapshot) {
vm[key] = createRecord(snapshot)
}, cancelCallback)
Expand Down
2 changes: 1 addition & 1 deletion dist/vuefire.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuefire",
"version": "1.2.0",
"version": "1.2.1",
"description": "Firebase bindings for Vue.js",
"main": "dist/vuefire.js",
"files": [
Expand Down

0 comments on commit 802c224

Please sign in to comment.