Skip to content

Commit

Permalink
$isChrome
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Jan 7, 2018
1 parent bf13184 commit 75f98b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/devtools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import store from './store'
import './plugins'
import { parse } from '../util'

const isChrome = typeof chrome !== 'undefined' && chrome.devtools
const isChrome = typeof chrome !== 'undefined' && !!chrome.devtools
Object.defineProperty(Vue.prototype, '$isChrome', {
get () { return isChrome }
})

let panelShown = !isChrome
let pendingAction = null
Expand Down
9 changes: 4 additions & 5 deletions src/devtools/views/components/ComponentInspector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span v-tooltip="titleTooltip">{{ targetName }}</span>
<span class="title-bracket">&gt;</span>
</span>
<a v-if="isChrome" class="button inspect" @click="inspectDOM" v-tooltip="'Inspect DOM'">
<a v-if="$isChrome" class="button inspect" @click="inspectDOM" v-tooltip="'Inspect DOM'">
<i class="material-icons">find_in_page</i>
<span>Inspect DOM</span>
</a>
Expand Down Expand Up @@ -48,8 +48,7 @@ export default {
},
data () {
return {
filter: '',
isChrome: typeof chrome !== 'undefined' && !!chrome.devtools
filter: ''
}
},
computed: {
Expand All @@ -76,7 +75,7 @@ export default {
methods: {
inspectDOM () {
if (!this.hasTarget) return
if (this.isChrome) {
if (this.$isChrome) {
chrome.devtools.inspectedWindow.eval(
`inspect(window.__VUE_DEVTOOLS_INSTANCE_MAP__.get("${this.target.id}").$el)`
)
Expand All @@ -100,7 +99,7 @@ export default {
console.log('Check the setup of your project, see https://github.com/vuejs/vue-devtools/blob/master/docs/open-in-editor.md')
}
})`
if (this.isChrome) {
if (this.$isChrome) {
chrome.devtools.inspectedWindow.eval(src)
} else {
// eslint-disable-next-line no-eval
Expand Down

0 comments on commit 75f98b9

Please sign in to comment.