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:
+12
-5
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user