Files
apollo/src/utils.js
T
2017-05-01 01:10:54 +02:00

23 lines
495 B
JavaScript

import loThrottle from 'lodash.throttle'
import loDebounce from 'lodash.debounce'
export const Globals = {}
function factory (action) {
return (cb, options) => {
if (typeof options === 'number') {
return action(cb, options)
} else {
return action(cb, options.wait, options)
}
}
}
export const throttle = factory(loThrottle)
export const debounce = factory(loDebounce)
export function getMergedDefinition (def) {
return Globals.Vue.util.mergeOptions({}, def)
}