Skip to content

Commit

Permalink
feat: Add a setting for "vue-devtools Detected Vue" console log, closes
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelmutschlechner authored and Guillaume Chau committed Mar 20, 2019
1 parent 144a4e6 commit 8220a74
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { stringify, classify, camelize, set, has, parse, getComponentName, getCu
import ComponentSelector from './component-selector'
import SharedData, { init as initSharedData } from 'src/shared-data'
import { isBrowser, target } from 'src/devtools/env'
import storage from 'src/devtools/storage'

// hook should have been injected before this executes.
const hook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__
Expand Down Expand Up @@ -153,12 +154,14 @@ function connect (Vue) {

bridge.log('backend ready.')
bridge.send('ready', Vue.version)
console.log(
`%c vue-devtools %c Detected Vue v${Vue.version} %c`,
'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
'background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff',
'background:transparent'
)
if (storage.get('shared-data:logDetected')) {
console.log(
`%c vue-devtools %c Detected Vue v${Vue.version} %c`,
'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
'background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff',
'background:transparent'
)
}

setTimeout(() => {
scan()
Expand Down
9 changes: 9 additions & 0 deletions src/devtools/views/settings/GlobalPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@
</VueGroup>
</VueFormField>

<VueFormField title="Detected Console Log">
<VueSwitch
:value="!$shared.logDetected"
@input="$shared.logDetected = !$event"
>
Disable
</VueSwitch>
</VueFormField>

<VueFormField title="Editable props">
<VueSwitch
:value="$shared.editableProps"
Expand Down
6 changes: 4 additions & 2 deletions src/shared-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ const internalSharedData = {
cacheVuexSnapshotsLimit: 10,
snapshotLoading: null,
recordPerf: false,
editableProps: false
editableProps: false,
logDetected: true
}

const persisted = [
'classifyComponents',
'theme',
'displayDensity',
'recordVuex',
'editableProps'
'editableProps',
'logDetected'
]

// ---- INTERNALS ---- //
Expand Down

0 comments on commit 8220a74

Please sign in to comment.