mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-17 23:30:34 +03:00
3e1a0da9e4
feat: show active metadata and add some styling chore: code cleanup
15 lines
466 B
TypeScript
15 lines
466 B
TypeScript
import { InjectionKey } from 'vue'
|
|
import { MetaActive } from './types'
|
|
|
|
export const hasSymbol = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'
|
|
|
|
export const PolySymbol = (name: string) =>
|
|
// vm = vue meta
|
|
hasSymbol
|
|
? Symbol(__DEV__ ? '[vue-meta]: ' + name : name)
|
|
: (__DEV__ ? '[vue-meta]: ' : '_vm_') + name
|
|
|
|
export const metaActiveKey = /*#__PURE__*/ PolySymbol(
|
|
__DEV__ ? 'meta_active' : 'ma'
|
|
) as InjectionKey<MetaActive>
|