diff --git a/docs/api/README.md b/docs/api/README.md
index 2e937e98..24f746e1 100644
--- a/docs/api/README.md
+++ b/docs/api/README.md
@@ -727,7 +727,7 @@ Calling [`inject`](#meta-inject) will return an object on which you can call the
### head
- arguments
- - ln (type `boolean`, default: `true`)
+ - ln (type `boolean`, default: `false`)
This is a convenience method which will retrieve the template string which should be added to the `head`.
@@ -737,7 +737,7 @@ By passing `ln = true` a line break will be added after each element. This could
### bodyPrepend
- arguments
- - ln (type `boolean`, default: `true`)
+ - ln (type `boolean`, default: `false`)
This is a convenience method which will retrieve the template string which should be prepended to the body, i.e. listed just after `
`.
@@ -745,7 +745,7 @@ Elements will be printed in the same order as the menu below.
### bodyAppend
- arguments
- - ln (type `boolean`, default: `true`)
+ - ln (type `boolean`, default: `false`)
This is a convenience method which will retrieve the template string which should be appended to the body, i.e. listed just before ``.
diff --git a/types/index.d.ts b/types/index.d.ts
index ed4d0f5e..73dcbd41 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -6,6 +6,7 @@ export default VueMeta
export {
VueMetaOptions,
VueMetaPlugin,
+ VueMetaApp,
MetaInfo,
MetaInfoSSR,
AttributeProperty,
diff --git a/types/test/index.ts b/types/test/index.ts
index 5eef5aa8..3d242e57 100644
--- a/types/test/index.ts
+++ b/types/test/index.ts
@@ -1,5 +1,12 @@
import Vue, { ComponentOptions } from 'vue'
-import VueMeta, { VueMetaPlugin, VueMetaOptions, MetaInfo, MetaInfoSSR } from '../index'
+import VueMeta, {
+ VueMetaPlugin,
+ VueMetaOptions,
+ VueMetaApp,
+ MetaInfo,
+ MetaInfoSSR,
+ MetaPropertyCharset
+} from '../index'
Vue.use(VueMeta, {
keyName: 'head'
@@ -67,6 +74,16 @@ if (metaDataSSR.script) {
metaDataSSR.script.text({ body: true })
}
+// add app
+const customApp: VueMetaApp = $meta.addApp('custom-app')
+
+const metaCharset: MetaPropertyCharset = { charset: 'utf-8' }
+const customAppInfo: MetaInfo = {
+ meta: [metaCharset]
+}
+
+customApp.set(customAppInfo)
+
// pausing & resuming
let resume
resume = $meta.pause()
diff --git a/types/vue-meta.d.ts b/types/vue-meta.d.ts
index 711fa3a7..6cef1428 100644
--- a/types/vue-meta.d.ts
+++ b/types/vue-meta.d.ts
@@ -5,13 +5,18 @@ type Component = ComponentOptions | typeof Vue
type CallbackFn = () => void
type elements = HTMLElement[]
-export interface VueMetaOptions {
+export interface VueMetaOptionsRuntime {
+ refreshOnceOnNavigation?: boolean
+ debounceWait?: number
+ waitOnDestroyed?: boolean
+}
+
+export interface VueMetaOptions extends VueMetaOptionsRuntime {
keyName: string, // the component option name that vue-meta looks for meta info on.
attribute: string, // the attribute name vue-meta adds to the tags it observes
ssrAppId: string, // the app id used for ssr app
ssrAttribute: string, // the attribute name that lets vue-meta know that meta info has already been server-rendered
tagIDKeyName: string // the property name that vue-meta uses to determine whether to overwrite or append a tag
- refreshOnceOnNavigation: boolean
}
export declare class VueMeta {
@@ -21,17 +26,26 @@ export declare class VueMeta {
static generate(metaInfo: MetaInfo, options?: Object): MetaInfoSSR
}
+interface RefreshedTags {
+ addedTags: elements
+ removedTags: elements
+}
+
interface Refreshed {
vm: Component,
metaInfo: MetaInfo,
- tags: {
- addedTags: elements
- removedTags: elements
- }
+ tags: RefreshedTags
+}
+
+interface VueMetaApp {
+ set(metaInfo: MetaInfo): void | RefreshedTags
+ remove(): void
}
export interface VueMetaPlugin {
getOptions(): VueMetaOptions
+ setOptions(runtimeOptions: VueMetaOptionsRuntime): VueMetaOptions
+ addApp(appName: string): VueMetaApp
refresh(): Refreshed
inject(): MetaInfoSSR
pause(refresh: true): () => Refreshed
@@ -188,6 +202,10 @@ interface ToTextBooleanArg {
text(addSrrAttribute?: boolean): string
}
+interface AddLineBreakOption {
+ ln: boolean
+}
+
interface ToBodyTextOption {
body: boolean
}
@@ -197,18 +215,21 @@ interface ToPbodyTextOption {
}
interface ToBodyText {
- text(options?: (ToBodyTextOption | ToPbodyTextOption)): string
+ text(options?: (ToBodyTextOption | ToPbodyTextOption | AddLineBreakOption)): string
}
export interface MetaInfoSSR {
+ head(ln?: boolean): string
+ bodyPrepend(ln?: boolean): string
+ bodyAppend(ln?: boolean): string
title?: ToText
htmlAttrs?: ToTextBooleanArg
headAttrs?: ToText
bodyAttrs?: ToText
- base?: ToText
- meta?: ToText
- link?: ToText
- style?: ToText
+ base?: ToBodyText
+ meta?: ToBodyText
+ link?: ToBodyText
+ style?: ToBodyText
script?: ToBodyText
noscript?: ToBodyText
}