Skip to content

Commit

Permalink
feat: preserve some devtools interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
LastLeaf committed Jul 3, 2024
1 parent 6533734 commit d1a945f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions glass-easel/src/dev_tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export interface DevTools {
performance?: PerformanceDevTools
}

export interface MountPointEnv {}

export interface InspectorDevTools {
addMountPoint(root: Element): void
addMountPoint(root: Element, env: MountPointEnv): void
removeMountPoint(root: Element): void
}

Expand Down Expand Up @@ -103,11 +105,13 @@ export const addTimelineEvent = (type: string, data?: Record<string, unknown>) =
}

export const attachInspector = (elem: Element) => {
if (!ENV.DEV) return
const inspector = getDevTools()?.inspector
inspector?.addMountPoint(elem)
inspector?.addMountPoint(elem, {})
}

export const detachInspector = (elem: Element) => {
if (!ENV.DEV) return
const inspector = getDevTools()?.inspector
inspector?.removeMountPoint(elem)
}
2 changes: 1 addition & 1 deletion glass-easel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export {
removeGlobalErrorListener,
removeGlobalWarningListener,
} from './warning'
export { DevTools, InspectorDevTools, PerformanceDevTools } from './dev_tools'
export { DevTools, InspectorDevTools, PerformanceDevTools, MountPointEnv } from './dev_tools'

import { type Behavior } from './behavior'
import {
Expand Down

0 comments on commit d1a945f

Please sign in to comment.