2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-18 03:10:34 +03:00
Files
vue-meta/src/client/$meta.js
T
2019-07-11 21:43:05 +02:00

35 lines
940 B
JavaScript

import { showWarningNotSupported } from '../shared/constants'
import { getOptions } from '../shared/options'
import { pause, resume } from '../shared/pausing'
import refresh from './refresh'
export default function _$meta (options = {}) {
const _refresh = refresh(options)
const inject = () => {}
/**
* Returns an injector for server-side rendering.
* @this {Object} - the Vue instance (a root component)
* @return {Object} - injector
*/
return function $meta () {
if (!this.$root._vueMeta) {
return {
getOptions: showWarningNotSupported,
refresh: showWarningNotSupported,
inject: showWarningNotSupported,
pause: showWarningNotSupported,
resume: showWarningNotSupported
}
}
return {
getOptions: () => getOptions(options),
refresh: _refresh.bind(this),
inject,
pause: pause.bind(this),
resume: resume.bind(this)
}
}
}