Skip to content

Commit 3b5fa09

Browse files
committed
2.0 compatibility
1 parent ea6d5cf commit 3b5fa09

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/vuefire.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,18 @@ function ensureRefs (vm) {
195195
}
196196
}
197197

198+
var init = function () {
199+
var bindings = this.$options.firebase
200+
if (!bindings) return
201+
ensureRefs(this)
202+
for (var key in bindings) {
203+
bind(this, key, bindings[key])
204+
}
205+
}
206+
198207
var VueFireMixin = {
199-
init: function () {
200-
var bindings = this.$options.firebase
201-
if (!bindings) return
202-
ensureRefs(this)
203-
for (var key in bindings) {
204-
bind(this, key, bindings[key])
205-
}
206-
},
208+
init: init, // 1.x
209+
beforeCreate: init, // 2.x
207210
beforeDestroy: function () {
208211
if (!this.$firebaseRefs) return
209212
for (var key in this.$firebaseRefs) {

0 commit comments

Comments
 (0)