Skip to content

Commit

Permalink
refactor: rename type Head to HeadClient
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Mar 5, 2021
1 parent 5e3374b commit fdd56f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type HeadTag = {
}
}

export type Head = {
export type HeadClient = {
install: (app: App) => void

headTags: HeadTag[]
Expand Down Expand Up @@ -81,7 +81,7 @@ const getTagKey = (props: any): { name: string; value: any } | void => {
* Exported for advanced usage or library integration, you probably don't need this
*/
export const injectHead = () => {
const head = inject<Head>(PROVIDE_KEY)
const head = inject<HeadClient>(PROVIDE_KEY)

if (!head) {
throw new Error(`You may forget to apply app.use(head)`)
Expand Down Expand Up @@ -212,7 +212,7 @@ const insertTags = (tags: HeadTag[], document = window.document) => {
export const createHead = () => {
let allHeadObjs: Ref<HeadObjectPlain>[] = []

const head: Head = {
const head: HeadClient = {
install(app) {
app.config.globalProperties.$head = head
app.provide(PROVIDE_KEY, head)
Expand Down Expand Up @@ -301,7 +301,7 @@ const tagToString = (tag: HeadTag) => {
return `<${tag.tag}${attrs}>${tag.props.children || ''}</${tag.tag}>`
}

export const renderHeadToString = (head: Head): HTMLResult => {
export const renderHeadToString = (head: HeadClient): HTMLResult => {
const tags: string[] = []
let titleTag = ''
let htmlAttrs: HeadAttrs = {}
Expand Down

0 comments on commit fdd56f1

Please sign in to comment.