Skip to content

Commit

Permalink
feat(devtools): allow disable logs
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 18, 2022
1 parent a64c19d commit 43f690f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/pinia/src/devtools/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ function addStoreToDevtools(app: DevtoolsApp, store: StoreGeneric) {
componentStateTypes,
app,
settings: {
logStoreChanges: {
label: 'Notify about new/deleted stores',
type: 'boolean',
defaultValue: true,
},
// useEmojis: {
// label: 'Use emojis in messages ⚡️',
// type: 'boolean',
Expand Down Expand Up @@ -443,14 +448,16 @@ function addStoreToDevtools(app: DevtoolsApp, store: StoreGeneric) {
api.notifyComponentUpdate()
api.sendInspectorTree(INSPECTOR_ID)
api.sendInspectorState(INSPECTOR_ID)
toastMessage(`Disposed "${store.$id}" store 🗑`)
api.getSettings().logStoreChanges &&
toastMessage(`Disposed "${store.$id}" store 🗑`)
}

// trigger an update so it can display new registered stores
api.notifyComponentUpdate()
api.sendInspectorTree(INSPECTOR_ID)
api.sendInspectorState(INSPECTOR_ID)
toastMessage(`"${store.$id}" store installed 🆕`)
api.getSettings().logStoreChanges &&
toastMessage(`"${store.$id}" store installed 🆕`)
}
)
}
Expand Down

0 comments on commit 43f690f

Please sign in to comment.