2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-13 06:52:26 +03:00

feat: major refactor, cleanup and jest tests

This commit is contained in:
pimlie
2019-02-09 21:45:22 +01:00
parent 9dfb001d4e
commit 5d64d43862
61 changed files with 8598 additions and 822 deletions
+12 -5
View File
@@ -1,7 +1,7 @@
import getMetaInfo from '../shared/getMetaInfo'
import updateClientMetaInfo from './updateClientMetaInfo'
export default function _refresh (options = {}) {
export default function _refresh(options = {}) {
/**
* When called, will update the current meta info with new meta info.
* Useful when updating meta info as the result of an asynchronous
@@ -12,9 +12,16 @@ export default function _refresh (options = {}) {
*
* @return {Object} - new meta info
*/
return function refresh () {
const info = getMetaInfo(options)(this.$root)
updateClientMetaInfo(options).call(this, info)
return info
return function refresh() {
const metaInfo = getMetaInfo(options, this.$root)
const tags = updateClientMetaInfo(options, metaInfo)
// emit "event" with new info
if (tags && typeof metaInfo.changed === 'function') {
metaInfo.changed.call(this, metaInfo, tags.addedTags, tags.removedTags)
}
return metaInfo
}
}