mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-18 01:00:33 +03:00
logically group modules into folders
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import updateTitle from './updateTitle'
|
||||
import updateTagAttributes from './updateTagAttributes'
|
||||
import { SERVER_RENDERED_ATTRIBUTE } from './constants'
|
||||
import updateTitle from './updaters/updateTitle'
|
||||
import updateTagAttributes from './updaters/updateTagAttributes'
|
||||
import { SERVER_RENDERED_ATTRIBUTE } from '../shared/constants'
|
||||
|
||||
if (typeof window !== 'undefined' && window !== null) {
|
||||
var htmlTag = document.getElementsByTagName('html')[0]
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VUE_META_ATTRIBUTE } from './constants'
|
||||
import { VUE_META_ATTRIBUTE } from '../../shared/constants'
|
||||
|
||||
/**
|
||||
* updates the document's html tag attributes
|
||||
+2
-34
@@ -1,35 +1,3 @@
|
||||
import $meta from './$meta'
|
||||
import getMetaInfo from './getMetaInfo'
|
||||
import updateClientMetaInfo from './updateClientMetaInfo'
|
||||
import install from './shared/plugin'
|
||||
|
||||
// automatic install
|
||||
if (typeof Vue !== 'undefined') {
|
||||
Vue.use(VueMeta)
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin install function.
|
||||
* @param {Function} Vue - the Vue constructor.
|
||||
*/
|
||||
export default function VueMeta (Vue) {
|
||||
// bind the $meta method to this component instance
|
||||
Vue.prototype.$meta = $meta
|
||||
|
||||
// store an id to keep track of DOM updates
|
||||
let requestId = null
|
||||
|
||||
// watch for client side component updates
|
||||
Vue.mixin({
|
||||
beforeMount () {
|
||||
// batch potential DOM updates to prevent extraneous re-rendering
|
||||
window.cancelAnimationFrame(requestId)
|
||||
|
||||
requestId = window.requestAnimationFrame(() => {
|
||||
requestId = null
|
||||
|
||||
// update the meta info
|
||||
updateClientMetaInfo(getMetaInfo(this.$root), this.$root)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
export default install
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import titleGenerator from './titleGenerator'
|
||||
import attrsGenerator from './attrsGenerator'
|
||||
import titleGenerator from './generators/titleGenerator'
|
||||
import attrsGenerator from './generators/attrsGenerator'
|
||||
|
||||
/**
|
||||
* Converts a meta info property to one that can be stringified on the server
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VUE_META_ATTRIBUTE } from './constants'
|
||||
import { VUE_META_ATTRIBUTE } from '../../shared/constants'
|
||||
|
||||
/**
|
||||
* Generates tag attributes for use on the server.
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VUE_META_ATTRIBUTE } from './constants'
|
||||
import { VUE_META_ATTRIBUTE } from '../../shared/constants'
|
||||
|
||||
/**
|
||||
* Generates title output for the server
|
||||
@@ -1,4 +1,4 @@
|
||||
import getMetaInfo from './getMetaInfo'
|
||||
import getMetaInfo from '../shared/getMetaInfo'
|
||||
import generateServerInjector from './generateServerInjector'
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,35 @@
|
||||
import getMetaInfo from './getMetaInfo'
|
||||
import $meta from '../server/$meta'
|
||||
import updateClientMetaInfo from '../client/updateClientMetaInfo'
|
||||
|
||||
// automatic install
|
||||
if (typeof Vue !== 'undefined') {
|
||||
Vue.use(VueMeta)
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin install function.
|
||||
* @param {Function} Vue - the Vue constructor.
|
||||
*/
|
||||
export default function VueMeta (Vue) {
|
||||
// bind the $meta method to this component instance
|
||||
Vue.prototype.$meta = $meta
|
||||
|
||||
// store an id to keep track of DOM updates
|
||||
let requestId = null
|
||||
|
||||
// watch for client side component updates
|
||||
Vue.mixin({
|
||||
beforeMount () {
|
||||
// batch potential DOM updates to prevent extraneous re-rendering
|
||||
window.cancelAnimationFrame(requestId)
|
||||
|
||||
requestId = window.requestAnimationFrame(() => {
|
||||
requestId = null
|
||||
|
||||
// update the meta info
|
||||
updateClientMetaInfo(getMetaInfo(this.$root), this.$root)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user