src/entity/Location.js
/**
 * Update locations given an array of new locations. If none is provided
 * it tries to use the current browser location for the update.
 *
 * @param {*} args - List of locations or nothing
 * @return {Promise}
 */
Update locations given an array of new locations. If none is provided
it tries to use the current browser location for the update.

@param {*} args - List of locations or nothing
@return {Promise}
Update locations given an array of new locations . If none is provided it tries to use the current browser location for the update . @param { * } args - List of locations or nothing @return { Promise }
function updateLocation (...args) {
  const [data, ...rest] = normalizeArguments(...args)
  const baseUpdate = Resource.prototype.update.bind(this)
  const updatedArgs = () => [data, ...rest]
  if (useGeolocation(data)) {
    return getCurrentPosition()
      .then((position) => {
        data[0] = fillLocation(data[0], position)
        return baseUpdate(...updatedArgs())
      })
      .catch((err) => {
        console.info(`Unable to get position: ${err}`)
        return baseUpdate(...updatedArgs())
      })
  } else {
    return baseUpdate(...updatedArgs())
  }
}
function updateLocation ( ... args ) { const [ data , ... rest ] = normalizeArguments ( ... args ) const baseUpdate = Resource . prototype . update . bind ( this ) const updatedArgs = ( ) => [ data , ... rest ] if ( useGeolocation ( data ) ) { return getCurrentPosition ( ) . then ( ( position ) => { data [ 0 ] = fillLocation ( data [ 0 ] , position ) return baseUpdate ( ... updatedArgs ( ) ) } ) . catch ( ( err ) => { console . info ( ` ${ err } ` ) return baseUpdate ( ... updatedArgs ( ) ) } ) } else { return baseUpdate ( ... updatedArgs ( ) ) } }
Update locations given an array of new locations.
Update locations given an array of new locations .