Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add os platform to pear-version component #15

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 1 addition & 44 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,51 +274,8 @@
<section>
<div class="col"><developer-tooling></developer-tooling></div>
</section>
<script type="module">
customElements.define('pear-version', class extends HTMLElement {
constructor () {
super()
this.template = document.createElement('template')
this.template.innerHTML = `
<style>
:host > div {
position: fixed;
top: 96vh;
font-size: .6rem;
background: #1a1a1a;
color: white;
opacity: 1;
padding: 8px;
padding-top: 0px;
padding-bottom: 0px;
border-radius: .35rem;
border: 1px solid #3a4816;
transition: top 0.3s;
display: block;
}

:host > div:hover {
top: 92vh;
transition: top 0.3s;
}
</style>
<div>
<p id="platform-version"></p>
<p id="app-version"></p>
</div>
`
this.root = this.attachShadow({ mode: 'open' })

Pear.versions().then(({ app, platform }) => {
this.root.appendChild(this.template.content.cloneNode(true))
this.root.querySelector('#platform-version').innerText = `Pear Runtime ${platform.fork}.${platform.length}.${platform.key}`
this.root.querySelector('#app-version').innerText = `Pear Desktop ${app.fork}.${app.length}.${app.key}`
})
}
})

</script>
<pear-version></pear-version>
<script type='module' src='./lib/pear-version.js'></script>
<script>
process.env.WS_NO_BUFFER_UTIL = false // ws buffer-util opt-out
</script>
Expand Down
46 changes: 46 additions & 0 deletions lib/pear-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* eslint-env browser, node */
import os from 'os'

customElements.define('pear-version', class extends HTMLElement {
constructor () {
super()
this.template = document.createElement('template')
this.template.innerHTML = `
<style>
:host > div {
position: fixed;
top: 96vh;
font-size: .6rem;
background: #1a1a1a;
color: white;
opacity: 1;
padding: 8px;
padding-top: 0px;
padding-bottom: 0px;
border-radius: .35rem;
border: 1px solid #3a4816;
transition: top 0.3s;
display: block;
}

:host > div:hover {
top: 92vh;
transition: top 0.3s;
}
</style>
<div>
<p id="platform-version"></p>
<p id="app-version"></p>
<p id="os-version"></p>
</div>
`
this.root = this.attachShadow({ mode: 'open' })

Pear.versions().then(({ app, platform }) => {
this.root.appendChild(this.template.content.cloneNode(true))
this.root.querySelector('#platform-version').innerText = `Pear Runtime ${platform.fork}.${platform.length}.${platform.key}`
this.root.querySelector('#app-version').innerText = `Pear Desktop ${app.fork}.${app.length}.${app.key}`
this.root.querySelector('#os-version').innerText = `OS Platform ${os.platform()} ${os.arch()} ${os.release()}`
})
}
})
Loading