MCPcopy Create free account
hub / github.com/TanStack/devtools / constructor

Method constructor

packages/angular-devtools/src/devtools.ts:63–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 readonly #destroyRef = inject(DestroyRef)
62
63 constructor() {
64 afterNextRender(() => {
65 const hostEl = this.elementRef.nativeElement
66
67 const pluginsMap = this.getPluginsMap()
68
69 const devtoolsCore = new TanStackDevtoolsCore({
70 config: this.config(),
71 eventBusConfig: this.eventBusConfig(),
72 plugins: pluginsMap,
73 })
74
75 this.devtools.set(devtoolsCore)
76
77 devtoolsCore.mount(hostEl)
78 })
79
80 effect(() => {
81 const devtools = this.devtools()
82 if (!devtools) {
83 return
84 }
85
86 const plugins = this.plugins()
87 const config = this.config()
88 const eventBusConfig = this.eventBusConfig()
89
90 this.#destroyAllComponents()
91
92 devtools.setConfig({
93 config,
94 eventBusConfig,
95 plugins: plugins?.map((p) => this.convertPlugin(p)) ?? [],
96 })
97 })
98
99 this.#destroyRef.onDestroy(() => {
100 this.#destroyAllComponents()
101 const devtools = this.devtools()
102 if (devtools) {
103 devtools.unmount()
104 this.devtools.set(null)
105 }
106 })
107 }
108
109 private getPluginsMap(): Array<TanStackDevtoolsPlugin> {
110 const plugins = this.plugins()

Callers

nothing calls this directly

Calls 6

getPluginsMapMethod · 0.95
mountMethod · 0.95
#destroyAllComponentsMethod · 0.95
convertPluginMethod · 0.95
setConfigMethod · 0.80
unmountMethod · 0.45

Tested by

no test coverage detected