(
el: T,
props: TanStackDevtoolsPluginProps,
)
| 24 | constructor() {} |
| 25 | |
| 26 | async mount<T extends HTMLElement>( |
| 27 | el: T, |
| 28 | props: TanStackDevtoolsPluginProps, |
| 29 | ) { |
| 30 | if (this.#isMounted || this.#isMounting) { |
| 31 | throw new Error('Devtools is already mounted') |
| 32 | } |
| 33 | this.#isMounting = true |
| 34 | this.#abortMount = false |
| 35 | |
| 36 | try { |
| 37 | const { __mountComponent } = await import('./class-mount-impl') |
| 38 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- can be set by unmount() during await |
| 39 | if (this.#abortMount) { |
| 40 | this.#isMounting = false |
| 41 | return |
| 42 | } |
| 43 | |
| 44 | this.#dispose = __mountComponent(el, props, importFn) |
| 45 | this.#isMounted = true |
| 46 | this.#isMounting = false |
| 47 | } catch (err) { |
| 48 | this.#isMounting = false |
| 49 | console.error('[TanStack Devtools] Failed to load:', err) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | unmount() { |
| 54 | if (!this.#isMounted && !this.#isMounting) { |
no test coverage detected