Skip to content

Commit aaa03d2

Browse files
committed
feat: introducing lazyLoad option
1 parent 9b48ec6 commit aaa03d2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/core/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ export interface VitePluginInspectorOptions {
7676
* @default false
7777
*/
7878
openInEditorHost?: string | false
79+
80+
/**
81+
* lazy load inspector times (ms)
82+
* @default false
83+
*/
84+
lazyLoad?: number | false
7985
}
8086

8187
const toggleComboKeysMap = {
@@ -101,6 +107,7 @@ export const DEFAULT_INSPECTOR_OPTIONS: VitePluginInspectorOptions = {
101107
toggleButtonPos: 'top-right',
102108
appendTo: '',
103109
openInEditorHost: false,
110+
lazyLoad: false,
104111
} as const
105112

106113
function VitePluginInspector(options: VitePluginInspectorOptions = DEFAULT_INSPECTOR_OPTIONS): PluginOption {

packages/core/src/load.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ function load() {
3737
}).$mount(`#${CONTAINER_ID}`)
3838
}
3939

40-
load()
40+
if (inspectorOptions.lazyLoad)
41+
setTimeout(load, inspectorOptions.lazyLoad)
42+
43+
else
44+
load()

0 commit comments

Comments
 (0)