chikadance
chikadance

Reputation: 4167

How to distinguish between electron and google chrome environment

For example the following code:

<div id="app">
  <wv></wv>
</div>
<script>
  if (inCrm()) {
    Vue.component("wv", {
      template: `<iframe></iframe>`
    })
  } else if (inElectron()) {
    Vue.component("wv", {
      template: `<webview></webview>`
    }) 
  }
  new Vue({el: "#app"})
</script>

I hope to debug in chrome and run in electron, how to distinguish between the two at runtime?

Upvotes: 1

Views: 100

Answers (1)

chikadance
chikadance

Reputation: 4167

I find the solution in here

use following code:

window && window.process && window.process.type

Upvotes: 1

Related Questions