From 5f52e88d4b074f1d80a1389c0c6ee91bf907c71b Mon Sep 17 00:00:00 2001 From: David Alexander Bjerremose Date: Wed, 10 Aug 2016 22:57:17 +0200 Subject: [PATCH 01/12] Enabled firebase to be called as function --- dist/vuefire.js | 1 + dist/vuefire.min.js | 2 +- src/vuefire.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/vuefire.js b/dist/vuefire.js index 25d5c7c4..4d271651 100644 --- a/dist/vuefire.js +++ b/dist/vuefire.js @@ -254,6 +254,7 @@ return /******/ (function(modules) { // webpackBootstrap var init = function () { var bindings = this.$options.firebase if (!bindings) return + if (typeof bindings === 'function') bindings = bindings.call(this) ensureRefs(this) for (var key in bindings) { bind(this, key, bindings[key]) diff --git a/dist/vuefire.min.js b/dist/vuefire.min.js index 65100abd..b4944816 100644 --- a/dist/vuefire.min.js +++ b/dist/vuefire.min.js @@ -1 +1 @@ -!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.VueFire=i():e.VueFire=i()}(this,function(){return function(e){function i(n){if(r[n])return r[n].exports;var t=r[n]={exports:{},id:n,loaded:!1};return e[n].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}var r={};return i.m=e,i.c=r,i.p="",i(0)}([function(e,i){function r(e){return"function"==typeof e.key?e.key():e.key}function n(e){return"function"==typeof e.ref?e=e.ref():"object"==typeof e.ref&&(e=e.ref),e}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var i=e.val(),n=t(i)?i:{".value":i};return n[".key"]=r(e),n}function s(e,i){for(var r=0;r Date: Thu, 11 Aug 2016 15:53:09 +0200 Subject: [PATCH 02/12] Added basic test case for ability to run as function --- tests/vuefire.spec.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tests/vuefire.spec.js b/tests/vuefire.spec.js index f5877fe5..eaa87e78 100644 --- a/tests/vuefire.spec.js +++ b/tests/vuefire.spec.js @@ -12,9 +12,11 @@ var firebaseApp = Firebase.initializeApp({ describe('VueFire', function () { var firebaseRef + var firebaseDb beforeEach(function (done) { - firebaseRef = firebaseApp.database().ref() + firebaseDb = firebaseApp.database() + firebaseRef = firebaseDb.ref() firebaseRef.remove(function (error) { if (error) { done(error) @@ -25,6 +27,36 @@ describe('VueFire', function () { }) }) + describe('is callable as Function', function () { + it('returns correct ref on function call', function (done) { + var ChildComponent = Vue.extend({ + name: 'ChildComponent', + firebase: function () { + expect(this.$root.database).to.deep.equal(firebaseDb) + done() + }, + template: '
test
' + }) + new Vue({ + data: function () { + return { + database: firebaseDb + } + }, + ready: function () { + expect('poop').to.equal('notpoop') + }, + components: { + 'child-component': ChildComponent + }, + template: '
' + }).$mount() + Vue.nextTick(function () { + + }) + }) + }) + describe('bind as Array', function () { it('throws error for invalid firebase ref', function () { helpers.invalidFirebaseRefs.forEach(function (ref) { From 327203a47173fcc096e702e379a584089d4dd451 Mon Sep 17 00:00:00 2001 From: David Bjerremose Date: Thu, 11 Aug 2016 16:13:05 +0200 Subject: [PATCH 03/12] Deleted compiled files --- dist/vuefire.js | 328 -------------------------------------------- dist/vuefire.min.js | 1 - 2 files changed, 329 deletions(-) delete mode 100644 dist/vuefire.js delete mode 100644 dist/vuefire.min.js diff --git a/dist/vuefire.js b/dist/vuefire.js deleted file mode 100644 index 4d271651..00000000 --- a/dist/vuefire.js +++ /dev/null @@ -1,328 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["VueFire"] = factory(); - else - root["VueFire"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports) { - - var Vue // late binding - - /** - * Returns the key of a Firebase snapshot across SDK versions. - * - * @param {FirebaseSnapshot} snapshot - * @return {string|null} - */ - function _getKey (snapshot) { - return typeof snapshot.key === 'function' - ? snapshot.key() - : snapshot.key - } - - /** - * Returns the original reference of a Firebase reference or query across SDK versions. - * - * @param {FirebaseReference|FirebaseQuery} refOrQuery - * @return {FirebaseReference} - */ - function _getRef (refOrQuery) { - if (typeof refOrQuery.ref === 'function') { - refOrQuery = refOrQuery.ref() - } else if (typeof refOrQuery.ref === 'object') { - refOrQuery = refOrQuery.ref - } - - return refOrQuery - } - - /** - * Check if a value is an object. - * - * @param {*} val - * @return {boolean} - */ - function isObject (val) { - return Object.prototype.toString.call(val) === '[object Object]' - } - - /** - * Convert firebase snapshot into a bindable data record. - * - * @param {FirebaseSnapshot} snapshot - * @return {Object} - */ - function createRecord (snapshot) { - var value = snapshot.val() - var res = isObject(value) - ? value - : { '.value': value } - res['.key'] = _getKey(snapshot) - return res - } - - /** - * Find the index for an object with given key. - * - * @param {array} array - * @param {string} key - * @return {number} - */ - function indexForKey (array, key) { - for (var i = 0; i < array.length; i++) { - if (array[i]['.key'] === key) { - return i - } - } - /* istanbul ignore next */ - return -1 - } - - /** - * Bind a firebase data source to a key on a vm. - * - * @param {Vue} vm - * @param {string} key - * @param {object} source - */ - function bind (vm, key, source) { - var asObject = false - var cancelCallback = null - // check { source, asArray, cancelCallback } syntax - if (isObject(source) && source.hasOwnProperty('source')) { - asObject = source.asObject - cancelCallback = source.cancelCallback - source = source.source - } - if (!isObject(source)) { - throw new Error('VueFire: invalid Firebase binding source.') - } - var ref = _getRef(source) - vm.$firebaseRefs[key] = ref - vm._firebaseSources[key] = source - // bind based on initial value type - if (asObject) { - bindAsObject(vm, key, source, cancelCallback) - } else { - bindAsArray(vm, key, source, cancelCallback) - } - } - - /** - * Bind a firebase data source to a key on a vm as an Array. - * - * @param {Vue} vm - * @param {string} key - * @param {object} source - * @param {function|null} cancelCallback - */ - function bindAsArray (vm, key, source, cancelCallback) { - var array = [] - Vue.util.defineReactive(vm, key, array) - - var onAdd = source.on('child_added', function (snapshot, prevKey) { - var index = prevKey ? indexForKey(array, prevKey) + 1 : 0 - array.splice(index, 0, createRecord(snapshot)) - }, cancelCallback) - - var onRemove = source.on('child_removed', function (snapshot) { - var index = indexForKey(array, _getKey(snapshot)) - array.splice(index, 1) - }, cancelCallback) - - var onChange = source.on('child_changed', function (snapshot) { - var index = indexForKey(array, _getKey(snapshot)) - array.splice(index, 1, createRecord(snapshot)) - }, cancelCallback) - - var onMove = source.on('child_moved', function (snapshot, prevKey) { - var index = indexForKey(array, _getKey(snapshot)) - var record = array.splice(index, 1)[0] - var newIndex = prevKey ? indexForKey(array, prevKey) + 1 : 0 - array.splice(newIndex, 0, record) - }, cancelCallback) - - vm._firebaseListeners[key] = { - child_added: onAdd, - child_removed: onRemove, - child_changed: onChange, - child_moved: onMove - } - } - - /** - * Bind a firebase data source to a key on a vm as an Object. - * - * @param {Vue} vm - * @param {string} key - * @param {Object} source - * @param {function|null} cancelCallback - */ - function bindAsObject (vm, key, source, cancelCallback) { - Vue.util.defineReactive(vm, key, {}) - var cb = source.on('value', function (snapshot) { - vm[key] = createRecord(snapshot) - }, cancelCallback) - vm._firebaseListeners[key] = { value: cb } - } - - /** - * Unbind a firebase-bound key from a vm. - * - * @param {Vue} vm - * @param {string} key - */ - function unbind (vm, key) { - var source = vm._firebaseSources && vm._firebaseSources[key] - if (!source) { - throw new Error( - 'VueFire: unbind failed: "' + key + '" is not bound to ' + - 'a Firebase reference.' - ) - } - var listeners = vm._firebaseListeners[key] - for (var event in listeners) { - source.off(event, listeners[event]) - } - vm[key] = null - vm.$firebaseRefs[key] = null - vm._firebaseSources[key] = null - vm._firebaseListeners[key] = null - } - - /** - * Ensure the related bookkeeping variables on an instance. - * - * @param {Vue} vm - */ - function ensureRefs (vm) { - if (!vm.$firebaseRefs) { - vm.$firebaseRefs = Object.create(null) - vm._firebaseSources = Object.create(null) - vm._firebaseListeners = Object.create(null) - } - } - - var init = function () { - var bindings = this.$options.firebase - if (!bindings) return - if (typeof bindings === 'function') bindings = bindings.call(this) - ensureRefs(this) - for (var key in bindings) { - bind(this, key, bindings[key]) - } - } - - var VueFireMixin = { - init: init, // 1.x - beforeCreate: init, // 2.x - beforeDestroy: function () { - if (!this.$firebaseRefs) return - for (var key in this.$firebaseRefs) { - if (this.$firebaseRefs[key]) { - this.$unbind(key) - } - } - this.$firebaseRefs = null - this._firebaseSources = null - this._firebaseListeners = null - } - } - - /** - * Install function passed to Vue.use() in manual installation. - * - * @param {function} _Vue - */ - function install (_Vue) { - Vue = _Vue - Vue.mixin(VueFireMixin) - - // use object-based merge strategy - var mergeStrats = Vue.config.optionMergeStrategies - mergeStrats.firebase = mergeStrats.methods - - // extend instance methods - Vue.prototype.$bindAsObject = function (key, source, cancelCallback) { - ensureRefs(this) - bind(this, key, { - source: source, - asObject: true, - cancelCallback: cancelCallback - }) - } - - Vue.prototype.$bindAsArray = function (key, source, cancelCallback) { - ensureRefs(this) - bind(this, key, { - source: source, - cancelCallback: cancelCallback - }) - } - - Vue.prototype.$unbind = function (key) { - unbind(this, key) - } - } - - // auto install - /* istanbul ignore if */ - if (typeof window !== 'undefined' && window.Vue) { - install(window.Vue) - } - - module.exports = install - - -/***/ } -/******/ ]) -}); -; \ No newline at end of file diff --git a/dist/vuefire.min.js b/dist/vuefire.min.js deleted file mode 100644 index b4944816..00000000 --- a/dist/vuefire.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.VueFire=i():e.VueFire=i()}(this,function(){return function(e){function i(r){if(n[r])return n[r].exports;var t=n[r]={exports:{},id:r,loaded:!1};return e[r].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}var n={};return i.m=e,i.c=n,i.p="",i(0)}([function(e,i){function n(e){return"function"==typeof e.key?e.key():e.key}function r(e){return"function"==typeof e.ref?e=e.ref():"object"==typeof e.ref&&(e=e.ref),e}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var i=e.val(),r=t(i)?i:{".value":i};return r[".key"]=n(e),r}function s(e,i){for(var n=0;n Date: Fri, 29 Jul 2016 23:28:29 +0200 Subject: [PATCH 04/12] Revert "Deleted compiled files" This reverts commit 327203a47173fcc096e702e379a584089d4dd451. --- dist/vuefire.js | 328 ++++++++++++++++++++++++++++++++++++++++++++ dist/vuefire.min.js | 1 + 2 files changed, 329 insertions(+) create mode 100644 dist/vuefire.js create mode 100644 dist/vuefire.min.js diff --git a/dist/vuefire.js b/dist/vuefire.js new file mode 100644 index 00000000..4d271651 --- /dev/null +++ b/dist/vuefire.js @@ -0,0 +1,328 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["VueFire"] = factory(); + else + root["VueFire"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + var Vue // late binding + + /** + * Returns the key of a Firebase snapshot across SDK versions. + * + * @param {FirebaseSnapshot} snapshot + * @return {string|null} + */ + function _getKey (snapshot) { + return typeof snapshot.key === 'function' + ? snapshot.key() + : snapshot.key + } + + /** + * Returns the original reference of a Firebase reference or query across SDK versions. + * + * @param {FirebaseReference|FirebaseQuery} refOrQuery + * @return {FirebaseReference} + */ + function _getRef (refOrQuery) { + if (typeof refOrQuery.ref === 'function') { + refOrQuery = refOrQuery.ref() + } else if (typeof refOrQuery.ref === 'object') { + refOrQuery = refOrQuery.ref + } + + return refOrQuery + } + + /** + * Check if a value is an object. + * + * @param {*} val + * @return {boolean} + */ + function isObject (val) { + return Object.prototype.toString.call(val) === '[object Object]' + } + + /** + * Convert firebase snapshot into a bindable data record. + * + * @param {FirebaseSnapshot} snapshot + * @return {Object} + */ + function createRecord (snapshot) { + var value = snapshot.val() + var res = isObject(value) + ? value + : { '.value': value } + res['.key'] = _getKey(snapshot) + return res + } + + /** + * Find the index for an object with given key. + * + * @param {array} array + * @param {string} key + * @return {number} + */ + function indexForKey (array, key) { + for (var i = 0; i < array.length; i++) { + if (array[i]['.key'] === key) { + return i + } + } + /* istanbul ignore next */ + return -1 + } + + /** + * Bind a firebase data source to a key on a vm. + * + * @param {Vue} vm + * @param {string} key + * @param {object} source + */ + function bind (vm, key, source) { + var asObject = false + var cancelCallback = null + // check { source, asArray, cancelCallback } syntax + if (isObject(source) && source.hasOwnProperty('source')) { + asObject = source.asObject + cancelCallback = source.cancelCallback + source = source.source + } + if (!isObject(source)) { + throw new Error('VueFire: invalid Firebase binding source.') + } + var ref = _getRef(source) + vm.$firebaseRefs[key] = ref + vm._firebaseSources[key] = source + // bind based on initial value type + if (asObject) { + bindAsObject(vm, key, source, cancelCallback) + } else { + bindAsArray(vm, key, source, cancelCallback) + } + } + + /** + * Bind a firebase data source to a key on a vm as an Array. + * + * @param {Vue} vm + * @param {string} key + * @param {object} source + * @param {function|null} cancelCallback + */ + function bindAsArray (vm, key, source, cancelCallback) { + var array = [] + Vue.util.defineReactive(vm, key, array) + + var onAdd = source.on('child_added', function (snapshot, prevKey) { + var index = prevKey ? indexForKey(array, prevKey) + 1 : 0 + array.splice(index, 0, createRecord(snapshot)) + }, cancelCallback) + + var onRemove = source.on('child_removed', function (snapshot) { + var index = indexForKey(array, _getKey(snapshot)) + array.splice(index, 1) + }, cancelCallback) + + var onChange = source.on('child_changed', function (snapshot) { + var index = indexForKey(array, _getKey(snapshot)) + array.splice(index, 1, createRecord(snapshot)) + }, cancelCallback) + + var onMove = source.on('child_moved', function (snapshot, prevKey) { + var index = indexForKey(array, _getKey(snapshot)) + var record = array.splice(index, 1)[0] + var newIndex = prevKey ? indexForKey(array, prevKey) + 1 : 0 + array.splice(newIndex, 0, record) + }, cancelCallback) + + vm._firebaseListeners[key] = { + child_added: onAdd, + child_removed: onRemove, + child_changed: onChange, + child_moved: onMove + } + } + + /** + * Bind a firebase data source to a key on a vm as an Object. + * + * @param {Vue} vm + * @param {string} key + * @param {Object} source + * @param {function|null} cancelCallback + */ + function bindAsObject (vm, key, source, cancelCallback) { + Vue.util.defineReactive(vm, key, {}) + var cb = source.on('value', function (snapshot) { + vm[key] = createRecord(snapshot) + }, cancelCallback) + vm._firebaseListeners[key] = { value: cb } + } + + /** + * Unbind a firebase-bound key from a vm. + * + * @param {Vue} vm + * @param {string} key + */ + function unbind (vm, key) { + var source = vm._firebaseSources && vm._firebaseSources[key] + if (!source) { + throw new Error( + 'VueFire: unbind failed: "' + key + '" is not bound to ' + + 'a Firebase reference.' + ) + } + var listeners = vm._firebaseListeners[key] + for (var event in listeners) { + source.off(event, listeners[event]) + } + vm[key] = null + vm.$firebaseRefs[key] = null + vm._firebaseSources[key] = null + vm._firebaseListeners[key] = null + } + + /** + * Ensure the related bookkeeping variables on an instance. + * + * @param {Vue} vm + */ + function ensureRefs (vm) { + if (!vm.$firebaseRefs) { + vm.$firebaseRefs = Object.create(null) + vm._firebaseSources = Object.create(null) + vm._firebaseListeners = Object.create(null) + } + } + + var init = function () { + var bindings = this.$options.firebase + if (!bindings) return + if (typeof bindings === 'function') bindings = bindings.call(this) + ensureRefs(this) + for (var key in bindings) { + bind(this, key, bindings[key]) + } + } + + var VueFireMixin = { + init: init, // 1.x + beforeCreate: init, // 2.x + beforeDestroy: function () { + if (!this.$firebaseRefs) return + for (var key in this.$firebaseRefs) { + if (this.$firebaseRefs[key]) { + this.$unbind(key) + } + } + this.$firebaseRefs = null + this._firebaseSources = null + this._firebaseListeners = null + } + } + + /** + * Install function passed to Vue.use() in manual installation. + * + * @param {function} _Vue + */ + function install (_Vue) { + Vue = _Vue + Vue.mixin(VueFireMixin) + + // use object-based merge strategy + var mergeStrats = Vue.config.optionMergeStrategies + mergeStrats.firebase = mergeStrats.methods + + // extend instance methods + Vue.prototype.$bindAsObject = function (key, source, cancelCallback) { + ensureRefs(this) + bind(this, key, { + source: source, + asObject: true, + cancelCallback: cancelCallback + }) + } + + Vue.prototype.$bindAsArray = function (key, source, cancelCallback) { + ensureRefs(this) + bind(this, key, { + source: source, + cancelCallback: cancelCallback + }) + } + + Vue.prototype.$unbind = function (key) { + unbind(this, key) + } + } + + // auto install + /* istanbul ignore if */ + if (typeof window !== 'undefined' && window.Vue) { + install(window.Vue) + } + + module.exports = install + + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/dist/vuefire.min.js b/dist/vuefire.min.js new file mode 100644 index 00000000..b4944816 --- /dev/null +++ b/dist/vuefire.min.js @@ -0,0 +1 @@ +!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.VueFire=i():e.VueFire=i()}(this,function(){return function(e){function i(r){if(n[r])return n[r].exports;var t=n[r]={exports:{},id:r,loaded:!1};return e[r].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}var n={};return i.m=e,i.c=n,i.p="",i(0)}([function(e,i){function n(e){return"function"==typeof e.key?e.key():e.key}function r(e){return"function"==typeof e.ref?e=e.ref():"object"==typeof e.ref&&(e=e.ref),e}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var i=e.val(),r=t(i)?i:{".value":i};return r[".key"]=n(e),r}function s(e,i){for(var n=0;n Date: Thu, 11 Aug 2016 17:58:11 +0200 Subject: [PATCH 05/12] Revert "Revert "Deleted compiled files"" This reverts commit a11bedd02f5ed132ad0a2d8038ddeb737592c56e. --- dist/vuefire.js | 328 -------------------------------------------- dist/vuefire.min.js | 1 - 2 files changed, 329 deletions(-) delete mode 100644 dist/vuefire.js delete mode 100644 dist/vuefire.min.js diff --git a/dist/vuefire.js b/dist/vuefire.js deleted file mode 100644 index 4d271651..00000000 --- a/dist/vuefire.js +++ /dev/null @@ -1,328 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["VueFire"] = factory(); - else - root["VueFire"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports) { - - var Vue // late binding - - /** - * Returns the key of a Firebase snapshot across SDK versions. - * - * @param {FirebaseSnapshot} snapshot - * @return {string|null} - */ - function _getKey (snapshot) { - return typeof snapshot.key === 'function' - ? snapshot.key() - : snapshot.key - } - - /** - * Returns the original reference of a Firebase reference or query across SDK versions. - * - * @param {FirebaseReference|FirebaseQuery} refOrQuery - * @return {FirebaseReference} - */ - function _getRef (refOrQuery) { - if (typeof refOrQuery.ref === 'function') { - refOrQuery = refOrQuery.ref() - } else if (typeof refOrQuery.ref === 'object') { - refOrQuery = refOrQuery.ref - } - - return refOrQuery - } - - /** - * Check if a value is an object. - * - * @param {*} val - * @return {boolean} - */ - function isObject (val) { - return Object.prototype.toString.call(val) === '[object Object]' - } - - /** - * Convert firebase snapshot into a bindable data record. - * - * @param {FirebaseSnapshot} snapshot - * @return {Object} - */ - function createRecord (snapshot) { - var value = snapshot.val() - var res = isObject(value) - ? value - : { '.value': value } - res['.key'] = _getKey(snapshot) - return res - } - - /** - * Find the index for an object with given key. - * - * @param {array} array - * @param {string} key - * @return {number} - */ - function indexForKey (array, key) { - for (var i = 0; i < array.length; i++) { - if (array[i]['.key'] === key) { - return i - } - } - /* istanbul ignore next */ - return -1 - } - - /** - * Bind a firebase data source to a key on a vm. - * - * @param {Vue} vm - * @param {string} key - * @param {object} source - */ - function bind (vm, key, source) { - var asObject = false - var cancelCallback = null - // check { source, asArray, cancelCallback } syntax - if (isObject(source) && source.hasOwnProperty('source')) { - asObject = source.asObject - cancelCallback = source.cancelCallback - source = source.source - } - if (!isObject(source)) { - throw new Error('VueFire: invalid Firebase binding source.') - } - var ref = _getRef(source) - vm.$firebaseRefs[key] = ref - vm._firebaseSources[key] = source - // bind based on initial value type - if (asObject) { - bindAsObject(vm, key, source, cancelCallback) - } else { - bindAsArray(vm, key, source, cancelCallback) - } - } - - /** - * Bind a firebase data source to a key on a vm as an Array. - * - * @param {Vue} vm - * @param {string} key - * @param {object} source - * @param {function|null} cancelCallback - */ - function bindAsArray (vm, key, source, cancelCallback) { - var array = [] - Vue.util.defineReactive(vm, key, array) - - var onAdd = source.on('child_added', function (snapshot, prevKey) { - var index = prevKey ? indexForKey(array, prevKey) + 1 : 0 - array.splice(index, 0, createRecord(snapshot)) - }, cancelCallback) - - var onRemove = source.on('child_removed', function (snapshot) { - var index = indexForKey(array, _getKey(snapshot)) - array.splice(index, 1) - }, cancelCallback) - - var onChange = source.on('child_changed', function (snapshot) { - var index = indexForKey(array, _getKey(snapshot)) - array.splice(index, 1, createRecord(snapshot)) - }, cancelCallback) - - var onMove = source.on('child_moved', function (snapshot, prevKey) { - var index = indexForKey(array, _getKey(snapshot)) - var record = array.splice(index, 1)[0] - var newIndex = prevKey ? indexForKey(array, prevKey) + 1 : 0 - array.splice(newIndex, 0, record) - }, cancelCallback) - - vm._firebaseListeners[key] = { - child_added: onAdd, - child_removed: onRemove, - child_changed: onChange, - child_moved: onMove - } - } - - /** - * Bind a firebase data source to a key on a vm as an Object. - * - * @param {Vue} vm - * @param {string} key - * @param {Object} source - * @param {function|null} cancelCallback - */ - function bindAsObject (vm, key, source, cancelCallback) { - Vue.util.defineReactive(vm, key, {}) - var cb = source.on('value', function (snapshot) { - vm[key] = createRecord(snapshot) - }, cancelCallback) - vm._firebaseListeners[key] = { value: cb } - } - - /** - * Unbind a firebase-bound key from a vm. - * - * @param {Vue} vm - * @param {string} key - */ - function unbind (vm, key) { - var source = vm._firebaseSources && vm._firebaseSources[key] - if (!source) { - throw new Error( - 'VueFire: unbind failed: "' + key + '" is not bound to ' + - 'a Firebase reference.' - ) - } - var listeners = vm._firebaseListeners[key] - for (var event in listeners) { - source.off(event, listeners[event]) - } - vm[key] = null - vm.$firebaseRefs[key] = null - vm._firebaseSources[key] = null - vm._firebaseListeners[key] = null - } - - /** - * Ensure the related bookkeeping variables on an instance. - * - * @param {Vue} vm - */ - function ensureRefs (vm) { - if (!vm.$firebaseRefs) { - vm.$firebaseRefs = Object.create(null) - vm._firebaseSources = Object.create(null) - vm._firebaseListeners = Object.create(null) - } - } - - var init = function () { - var bindings = this.$options.firebase - if (!bindings) return - if (typeof bindings === 'function') bindings = bindings.call(this) - ensureRefs(this) - for (var key in bindings) { - bind(this, key, bindings[key]) - } - } - - var VueFireMixin = { - init: init, // 1.x - beforeCreate: init, // 2.x - beforeDestroy: function () { - if (!this.$firebaseRefs) return - for (var key in this.$firebaseRefs) { - if (this.$firebaseRefs[key]) { - this.$unbind(key) - } - } - this.$firebaseRefs = null - this._firebaseSources = null - this._firebaseListeners = null - } - } - - /** - * Install function passed to Vue.use() in manual installation. - * - * @param {function} _Vue - */ - function install (_Vue) { - Vue = _Vue - Vue.mixin(VueFireMixin) - - // use object-based merge strategy - var mergeStrats = Vue.config.optionMergeStrategies - mergeStrats.firebase = mergeStrats.methods - - // extend instance methods - Vue.prototype.$bindAsObject = function (key, source, cancelCallback) { - ensureRefs(this) - bind(this, key, { - source: source, - asObject: true, - cancelCallback: cancelCallback - }) - } - - Vue.prototype.$bindAsArray = function (key, source, cancelCallback) { - ensureRefs(this) - bind(this, key, { - source: source, - cancelCallback: cancelCallback - }) - } - - Vue.prototype.$unbind = function (key) { - unbind(this, key) - } - } - - // auto install - /* istanbul ignore if */ - if (typeof window !== 'undefined' && window.Vue) { - install(window.Vue) - } - - module.exports = install - - -/***/ } -/******/ ]) -}); -; \ No newline at end of file diff --git a/dist/vuefire.min.js b/dist/vuefire.min.js deleted file mode 100644 index b4944816..00000000 --- a/dist/vuefire.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.VueFire=i():e.VueFire=i()}(this,function(){return function(e){function i(r){if(n[r])return n[r].exports;var t=n[r]={exports:{},id:r,loaded:!1};return e[r].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}var n={};return i.m=e,i.c=n,i.p="",i(0)}([function(e,i){function n(e){return"function"==typeof e.key?e.key():e.key}function r(e){return"function"==typeof e.ref?e=e.ref():"object"==typeof e.ref&&(e=e.ref),e}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var i=e.val(),r=t(i)?i:{".value":i};return r[".key"]=n(e),r}function s(e,i){for(var n=0;n Date: Thu, 11 Aug 2016 17:58:17 +0200 Subject: [PATCH 06/12] Revert "Deleted compiled files" This reverts commit 327203a47173fcc096e702e379a584089d4dd451. --- dist/vuefire.js | 328 ++++++++++++++++++++++++++++++++++++++++++++ dist/vuefire.min.js | 1 + 2 files changed, 329 insertions(+) create mode 100644 dist/vuefire.js create mode 100644 dist/vuefire.min.js diff --git a/dist/vuefire.js b/dist/vuefire.js new file mode 100644 index 00000000..4d271651 --- /dev/null +++ b/dist/vuefire.js @@ -0,0 +1,328 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["VueFire"] = factory(); + else + root["VueFire"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + var Vue // late binding + + /** + * Returns the key of a Firebase snapshot across SDK versions. + * + * @param {FirebaseSnapshot} snapshot + * @return {string|null} + */ + function _getKey (snapshot) { + return typeof snapshot.key === 'function' + ? snapshot.key() + : snapshot.key + } + + /** + * Returns the original reference of a Firebase reference or query across SDK versions. + * + * @param {FirebaseReference|FirebaseQuery} refOrQuery + * @return {FirebaseReference} + */ + function _getRef (refOrQuery) { + if (typeof refOrQuery.ref === 'function') { + refOrQuery = refOrQuery.ref() + } else if (typeof refOrQuery.ref === 'object') { + refOrQuery = refOrQuery.ref + } + + return refOrQuery + } + + /** + * Check if a value is an object. + * + * @param {*} val + * @return {boolean} + */ + function isObject (val) { + return Object.prototype.toString.call(val) === '[object Object]' + } + + /** + * Convert firebase snapshot into a bindable data record. + * + * @param {FirebaseSnapshot} snapshot + * @return {Object} + */ + function createRecord (snapshot) { + var value = snapshot.val() + var res = isObject(value) + ? value + : { '.value': value } + res['.key'] = _getKey(snapshot) + return res + } + + /** + * Find the index for an object with given key. + * + * @param {array} array + * @param {string} key + * @return {number} + */ + function indexForKey (array, key) { + for (var i = 0; i < array.length; i++) { + if (array[i]['.key'] === key) { + return i + } + } + /* istanbul ignore next */ + return -1 + } + + /** + * Bind a firebase data source to a key on a vm. + * + * @param {Vue} vm + * @param {string} key + * @param {object} source + */ + function bind (vm, key, source) { + var asObject = false + var cancelCallback = null + // check { source, asArray, cancelCallback } syntax + if (isObject(source) && source.hasOwnProperty('source')) { + asObject = source.asObject + cancelCallback = source.cancelCallback + source = source.source + } + if (!isObject(source)) { + throw new Error('VueFire: invalid Firebase binding source.') + } + var ref = _getRef(source) + vm.$firebaseRefs[key] = ref + vm._firebaseSources[key] = source + // bind based on initial value type + if (asObject) { + bindAsObject(vm, key, source, cancelCallback) + } else { + bindAsArray(vm, key, source, cancelCallback) + } + } + + /** + * Bind a firebase data source to a key on a vm as an Array. + * + * @param {Vue} vm + * @param {string} key + * @param {object} source + * @param {function|null} cancelCallback + */ + function bindAsArray (vm, key, source, cancelCallback) { + var array = [] + Vue.util.defineReactive(vm, key, array) + + var onAdd = source.on('child_added', function (snapshot, prevKey) { + var index = prevKey ? indexForKey(array, prevKey) + 1 : 0 + array.splice(index, 0, createRecord(snapshot)) + }, cancelCallback) + + var onRemove = source.on('child_removed', function (snapshot) { + var index = indexForKey(array, _getKey(snapshot)) + array.splice(index, 1) + }, cancelCallback) + + var onChange = source.on('child_changed', function (snapshot) { + var index = indexForKey(array, _getKey(snapshot)) + array.splice(index, 1, createRecord(snapshot)) + }, cancelCallback) + + var onMove = source.on('child_moved', function (snapshot, prevKey) { + var index = indexForKey(array, _getKey(snapshot)) + var record = array.splice(index, 1)[0] + var newIndex = prevKey ? indexForKey(array, prevKey) + 1 : 0 + array.splice(newIndex, 0, record) + }, cancelCallback) + + vm._firebaseListeners[key] = { + child_added: onAdd, + child_removed: onRemove, + child_changed: onChange, + child_moved: onMove + } + } + + /** + * Bind a firebase data source to a key on a vm as an Object. + * + * @param {Vue} vm + * @param {string} key + * @param {Object} source + * @param {function|null} cancelCallback + */ + function bindAsObject (vm, key, source, cancelCallback) { + Vue.util.defineReactive(vm, key, {}) + var cb = source.on('value', function (snapshot) { + vm[key] = createRecord(snapshot) + }, cancelCallback) + vm._firebaseListeners[key] = { value: cb } + } + + /** + * Unbind a firebase-bound key from a vm. + * + * @param {Vue} vm + * @param {string} key + */ + function unbind (vm, key) { + var source = vm._firebaseSources && vm._firebaseSources[key] + if (!source) { + throw new Error( + 'VueFire: unbind failed: "' + key + '" is not bound to ' + + 'a Firebase reference.' + ) + } + var listeners = vm._firebaseListeners[key] + for (var event in listeners) { + source.off(event, listeners[event]) + } + vm[key] = null + vm.$firebaseRefs[key] = null + vm._firebaseSources[key] = null + vm._firebaseListeners[key] = null + } + + /** + * Ensure the related bookkeeping variables on an instance. + * + * @param {Vue} vm + */ + function ensureRefs (vm) { + if (!vm.$firebaseRefs) { + vm.$firebaseRefs = Object.create(null) + vm._firebaseSources = Object.create(null) + vm._firebaseListeners = Object.create(null) + } + } + + var init = function () { + var bindings = this.$options.firebase + if (!bindings) return + if (typeof bindings === 'function') bindings = bindings.call(this) + ensureRefs(this) + for (var key in bindings) { + bind(this, key, bindings[key]) + } + } + + var VueFireMixin = { + init: init, // 1.x + beforeCreate: init, // 2.x + beforeDestroy: function () { + if (!this.$firebaseRefs) return + for (var key in this.$firebaseRefs) { + if (this.$firebaseRefs[key]) { + this.$unbind(key) + } + } + this.$firebaseRefs = null + this._firebaseSources = null + this._firebaseListeners = null + } + } + + /** + * Install function passed to Vue.use() in manual installation. + * + * @param {function} _Vue + */ + function install (_Vue) { + Vue = _Vue + Vue.mixin(VueFireMixin) + + // use object-based merge strategy + var mergeStrats = Vue.config.optionMergeStrategies + mergeStrats.firebase = mergeStrats.methods + + // extend instance methods + Vue.prototype.$bindAsObject = function (key, source, cancelCallback) { + ensureRefs(this) + bind(this, key, { + source: source, + asObject: true, + cancelCallback: cancelCallback + }) + } + + Vue.prototype.$bindAsArray = function (key, source, cancelCallback) { + ensureRefs(this) + bind(this, key, { + source: source, + cancelCallback: cancelCallback + }) + } + + Vue.prototype.$unbind = function (key) { + unbind(this, key) + } + } + + // auto install + /* istanbul ignore if */ + if (typeof window !== 'undefined' && window.Vue) { + install(window.Vue) + } + + module.exports = install + + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/dist/vuefire.min.js b/dist/vuefire.min.js new file mode 100644 index 00000000..b4944816 --- /dev/null +++ b/dist/vuefire.min.js @@ -0,0 +1 @@ +!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.VueFire=i():e.VueFire=i()}(this,function(){return function(e){function i(r){if(n[r])return n[r].exports;var t=n[r]={exports:{},id:r,loaded:!1};return e[r].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}var n={};return i.m=e,i.c=n,i.p="",i(0)}([function(e,i){function n(e){return"function"==typeof e.key?e.key():e.key}function r(e){return"function"==typeof e.ref?e=e.ref():"object"==typeof e.ref&&(e=e.ref),e}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var i=e.val(),r=t(i)?i:{".value":i};return r[".key"]=n(e),r}function s(e,i){for(var n=0;n Date: Thu, 11 Aug 2016 17:59:08 +0200 Subject: [PATCH 07/12] Changes to test spec --- tests/vuefire.spec.js | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/tests/vuefire.spec.js b/tests/vuefire.spec.js index eaa87e78..d6bbf641 100644 --- a/tests/vuefire.spec.js +++ b/tests/vuefire.spec.js @@ -12,11 +12,9 @@ var firebaseApp = Firebase.initializeApp({ describe('VueFire', function () { var firebaseRef - var firebaseDb beforeEach(function (done) { - firebaseDb = firebaseApp.database() - firebaseRef = firebaseDb.ref() + firebaseRef = firebaseApp.database().ref() firebaseRef.remove(function (error) { if (error) { done(error) @@ -27,33 +25,27 @@ describe('VueFire', function () { }) }) - describe('is callable as Function', function () { + describe('support Function options', function () { it('returns correct ref on function call', function (done) { - var ChildComponent = Vue.extend({ - name: 'ChildComponent', - firebase: function () { - expect(this.$root.database).to.deep.equal(firebaseDb) - done() - }, - template: '
test
' - }) + var firebaseDb = firebaseApp.database() new Vue({ data: function () { return { database: firebaseDb } }, - ready: function () { - expect('poop').to.equal('notpoop') - }, components: { - 'child-component': ChildComponent + 'child-component': Vue.extend({ + name: 'ChildComponent', + firebase: function () { + expect(this.$root.database).to.deep.equal(firebaseDb) + done() + }, + template: '
test
' + }) }, template: '
' }).$mount() - Vue.nextTick(function () { - - }) }) }) From 8af7c23988b786b09a19c40c5af6ab07826e18f6 Mon Sep 17 00:00:00 2001 From: David Alexander Bjerremose Date: Sun, 14 Aug 2016 20:00:39 +0200 Subject: [PATCH 08/12] Updated test to be more simple --- tests/vuefire.spec.js | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/tests/vuefire.spec.js b/tests/vuefire.spec.js index d6bbf641..16750675 100644 --- a/tests/vuefire.spec.js +++ b/tests/vuefire.spec.js @@ -26,26 +26,15 @@ describe('VueFire', function () { }) describe('support Function options', function () { - it('returns correct ref on function call', function (done) { - var firebaseDb = firebaseApp.database() - new Vue({ - data: function () { - return { - database: firebaseDb + it('option is callable as function', function (done) { + expect(function () { + new Vue({ + firebase: function () { + } - }, - components: { - 'child-component': Vue.extend({ - name: 'ChildComponent', - firebase: function () { - expect(this.$root.database).to.deep.equal(firebaseDb) - done() - }, - template: '
test
' - }) - }, - template: '
' - }).$mount() + }).$mount() + }).to.not.throw(/not a function/) + done() }) }) From 9846ea972116bdcdce981730356c144a04b2243f Mon Sep 17 00:00:00 2001 From: David Alexander Bjerremose Date: Tue, 23 Aug 2016 01:06:48 +0200 Subject: [PATCH 09/12] Removed regex from throw, added Sinon spy to call --- tests/vuefire.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/vuefire.spec.js b/tests/vuefire.spec.js index 16750675..ae5599f5 100644 --- a/tests/vuefire.spec.js +++ b/tests/vuefire.spec.js @@ -27,13 +27,13 @@ describe('VueFire', function () { describe('support Function options', function () { it('option is callable as function', function (done) { + var spy = sinon.spy() expect(function () { new Vue({ - firebase: function () { - - } + firebase: spy }).$mount() - }).to.not.throw(/not a function/) + }).to.not.throw() + expect(spy.calledOnce).to.be.true done() }) }) From 5c5acc6823c23dbbfaf1b31636738606f5194a86 Mon Sep 17 00:00:00 2001 From: David Alexander Bjerremose Date: Tue, 23 Aug 2016 18:29:44 +0200 Subject: [PATCH 10/12] Changed line order of check --- src/vuefire.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vuefire.js b/src/vuefire.js index 2d5660b8..28a3bc70 100644 --- a/src/vuefire.js +++ b/src/vuefire.js @@ -196,8 +196,8 @@ function ensureRefs (vm) { } var init = function () { + if (!this.$options.firebase) return var bindings = this.$options.firebase - if (!bindings) return if (typeof bindings === 'function') bindings = bindings.call(this) ensureRefs(this) for (var key in bindings) { From 5c39b0ee609f299c8a6a66135e20232d293b13ea Mon Sep 17 00:00:00 2001 From: David Alexander Bjerremose Date: Tue, 23 Aug 2016 18:49:13 +0200 Subject: [PATCH 11/12] Moved the correct line :P --- src/vuefire.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vuefire.js b/src/vuefire.js index 28a3bc70..60552c83 100644 --- a/src/vuefire.js +++ b/src/vuefire.js @@ -196,9 +196,9 @@ function ensureRefs (vm) { } var init = function () { - if (!this.$options.firebase) return var bindings = this.$options.firebase if (typeof bindings === 'function') bindings = bindings.call(this) + if (!bindings) return ensureRefs(this) for (var key in bindings) { bind(this, key, bindings[key]) From 80c24fc22204ec82a79448b2d5651b2a8e751103 Mon Sep 17 00:00:00 2001 From: David Alexander Bjerremose Date: Wed, 31 Aug 2016 00:01:49 +0200 Subject: [PATCH 12/12] Reverted changes to dist files --- dist/vuefire.js | 1 - dist/vuefire.min.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dist/vuefire.js b/dist/vuefire.js index 4d271651..25d5c7c4 100644 --- a/dist/vuefire.js +++ b/dist/vuefire.js @@ -254,7 +254,6 @@ return /******/ (function(modules) { // webpackBootstrap var init = function () { var bindings = this.$options.firebase if (!bindings) return - if (typeof bindings === 'function') bindings = bindings.call(this) ensureRefs(this) for (var key in bindings) { bind(this, key, bindings[key]) diff --git a/dist/vuefire.min.js b/dist/vuefire.min.js index b4944816..65100abd 100644 --- a/dist/vuefire.min.js +++ b/dist/vuefire.min.js @@ -1 +1 @@ -!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.VueFire=i():e.VueFire=i()}(this,function(){return function(e){function i(r){if(n[r])return n[r].exports;var t=n[r]={exports:{},id:r,loaded:!1};return e[r].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}var n={};return i.m=e,i.c=n,i.p="",i(0)}([function(e,i){function n(e){return"function"==typeof e.key?e.key():e.key}function r(e){return"function"==typeof e.ref?e=e.ref():"object"==typeof e.ref&&(e=e.ref),e}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var i=e.val(),r=t(i)?i:{".value":i};return r[".key"]=n(e),r}function s(e,i){for(var n=0;n