src/vuewild.js
function bind (vm, key, source) {
  var asObject = false
  var cancelCallback = null
  var readyCallback = null
  // check { source, asArray, cancelCallback } syntax
  if (isObject(source) && source.hasOwnProperty('source')) {
    asObject = source.asObject
    cancelCallback = source.cancelCallback
    readyCallback = source.readyCallback
    source = source.source
  }
  if (!isObject(source)) {
    throw new Error('VueWild: invalid Wilddog binding source.')
  }
  var ref = _getRef(source)
  vm.$wilddogRefs[key] = ref
  vm._wilddogSources[key] = source
  if (cancelCallback) {
    cancelCallback = cancelCallback.bind(vm)
  }
  // bind based on initial value type
  if (asObject) {
    bindAsObject(vm, key, source, cancelCallback)
  } else {
    bindAsArray(vm, key, source, cancelCallback)
  }
  if (readyCallback) {
    source.once('value', readyCallback.bind(vm))
  }
}
function bind (vm, key, source) {
  var asObject = false
  var cancelCallback = null
  var readyCallback = null
  // check { source, asArray, cancelCallback } syntax
  if (isObject(source) && source.hasOwnProperty('source')) {
    asObject = source.asObject
    cancelCallback = source.cancelCallback
    readyCallback = source.readyCallback
    source = source.source
  }
  if (!isObject(source)) {
    throw new Error('VueWild: invalid Wilddog binding source.')
  }
  var ref = _getRef(source)
  vm.$wilddogRefs[key] = ref
  vm._wilddogSources[key] = source
  if (cancelCallback) {
    cancelCallback = cancelCallback.bind(vm)
  }
  // bind based on initial value type
  if (asObject) {
    bindAsObject(vm, key, source, cancelCallback)
  } else {
    bindAsArray(vm, key, source, cancelCallback)
  }
  if (readyCallback) {
    source.once('value', readyCallback.bind(vm))
  }
}
function bind ( vm , key , source ) { var asObject = false var cancelCallback = null var readyCallback = null // check { source, asArray, cancelCallback } syntax if ( isObject ( source ) && source . hasOwnProperty ( 'source' ) ) { asObject = source . asObject cancelCallback = source . cancelCallback readyCallback = source . readyCallback source = source . source } if ( ! isObject ( source ) ) { throw new Error ( 'VueWild: invalid Wilddog binding source.' ) } var ref = _getRef ( source ) vm . $wilddogRefs [ key ] = ref vm . _wilddogSources [ key ] = source if ( cancelCallback ) { cancelCallback = cancelCallback . bind ( vm ) } // bind based on initial value type if ( asObject ) { bindAsObject ( vm , key , source , cancelCallback ) } else { bindAsArray ( vm , key , source , cancelCallback ) } if ( readyCallback ) { source . once ( 'value' , readyCallback . bind ( vm ) ) } }
Bind a wilddog data source to a key on a vm.

@param {Vue} vm
@param {string} key
@param {object} source
Bind a wilddog data source to a key on a vm .