Skip to content

Commit 1b140ea

Browse files
author
Eduard Aksamitov
committed
feat: option to disable client inspector
1 parent 0ae3c5f commit 1b140ea

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export interface DevtoolsOptions {
4242
clean?: boolean
4343
}
4444

45+
/**
46+
* Disable Logux Client in the componenet inspector.
47+
*/
48+
client?: boolean
49+
4550
/**
4651
* Disable action messages with specific types.
4752
*/

index.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,18 @@ export const devtools = {
3939
api => {
4040
devtools.api = api
4141

42-
api.on.inspectComponent(payload => {
43-
if (payload.instanceData) {
44-
payload.instanceData.state.push({
45-
type: 'Logux',
46-
key: '$client',
47-
editable: false,
48-
value: client
49-
})
50-
}
51-
})
42+
if (options.client !== false) {
43+
api.on.inspectComponent(payload => {
44+
if (payload.instanceData) {
45+
payload.instanceData.state.push({
46+
type: 'Logux',
47+
key: '$client',
48+
editable: false,
49+
value: client
50+
})
51+
}
52+
})
53+
}
5254

5355
if (layers.state !== false) {
5456
api.addTimelineLayer({

0 commit comments

Comments
 (0)