mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-19 08:20:34 +03:00
refactor: minimize function calls / use of bind
This commit is contained in:
+11
-13
@@ -4,7 +4,7 @@ import getMetaInfo from '../shared/getMetaInfo'
|
||||
import { isFunction } from '../utils/is-type'
|
||||
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
|
||||
@@ -15,20 +15,18 @@ export default function _refresh (options = {}) {
|
||||
*
|
||||
* @return {Object} - new meta info
|
||||
*/
|
||||
return function refresh () {
|
||||
// collect & aggregate all metaInfo $options
|
||||
const rawInfo = getComponentMetaInfo(options, this.$root)
|
||||
// collect & aggregate all metaInfo $options
|
||||
const rawInfo = getComponentMetaInfo(options, this.$root)
|
||||
|
||||
const metaInfo = getMetaInfo(options, rawInfo, clientSequences, this.$root)
|
||||
const metaInfo = getMetaInfo(options, rawInfo, clientSequences, this.$root)
|
||||
|
||||
const appId = this.$root._vueMeta.appId
|
||||
const tags = updateClientMetaInfo(appId, options, metaInfo)
|
||||
const appId = this.$root._vueMeta.appId
|
||||
const tags = updateClientMetaInfo(appId, options, metaInfo)
|
||||
|
||||
// emit "event" with new info
|
||||
if (tags && isFunction(metaInfo.changed)) {
|
||||
metaInfo.changed(metaInfo, tags.addedTags, tags.removedTags)
|
||||
}
|
||||
|
||||
return { vm: this, metaInfo, tags }
|
||||
// emit "event" with new info
|
||||
if (tags && isFunction(metaInfo.changed)) {
|
||||
metaInfo.changed(metaInfo, tags.addedTags, tags.removedTags)
|
||||
}
|
||||
|
||||
return { vm: this, metaInfo, tags }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user