| 801 | } |
| 802 | |
| 803 | export function useHost(caller?: string): VueElement | null { |
| 804 | const instance = getCurrentInstance() |
| 805 | const el = instance && (instance.ce as VueElement) |
| 806 | if (el) { |
| 807 | return el |
| 808 | } else if (__DEV__) { |
| 809 | if (!instance) { |
| 810 | warn( |
| 811 | `${caller || 'useHost'} called without an active component instance.`, |
| 812 | ) |
| 813 | } else { |
| 814 | warn( |
| 815 | `${caller || 'useHost'} can only be used in components defined via ` + |
| 816 | `defineCustomElement.`, |
| 817 | ) |
| 818 | } |
| 819 | } |
| 820 | return null |
| 821 | } |
| 822 | |
| 823 | /** |
| 824 | * Retrieve the shadowRoot of the current custom element. Only usable in setup() |