From e9998246de55d128a063ab12edb01b45836d00f8 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 8 Apr 2021 23:25:50 +0200 Subject: [PATCH] minor fixes --- carbonara.ts | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/carbonara.ts b/carbonara.ts index e5b0418..0d7d8b4 100644 --- a/carbonara.ts +++ b/carbonara.ts @@ -73,7 +73,7 @@ class Carbonara extends HTMLElement { private transfer = 0; private duration = 0; - private frequency = 500; + private frequency = 200; private timer: number; private store: Storage; @@ -125,10 +125,10 @@ class Carbonara extends HTMLElement { const carbon = kWhDataCenter + kWhNetwork + kWhDevice; this.shadowRoot.getElementById("device").textContent = `${i18n[this.language].device} ${this.mobile ? "mobile" : "desktop"}`; this.shadowRoot.getElementById("zone").textContent = `${i18n[this.language].zone} ${this.zone}`; - this.shadowRoot.getElementById("transfer").textContent = `${i18n[this.language].transfer} ${Math.round(transfer / 1024)} ko`; - this.shadowRoot.getElementById("duration").textContent = `${i18n[this.language].duration} ${Math.round(this.duration * 60)} s`; + this.shadowRoot.getElementById("transfer").textContent = `${i18n[this.language].transfer} ${Intl.NumberFormat().format(Math.round(transfer / 1024))} ko`; + this.shadowRoot.getElementById("duration").textContent = `${i18n[this.language].duration} ${Intl.NumberFormat().format(Math.round(this.duration * 60))} s`; this.shadowRoot.getElementById("reinsurance").textContent = `${i18n[this.language].reinsurance}`; - this.shadowRoot.getElementById("carbon").textContent = `${Intl.NumberFormat([],{maximumFractionDigits: 3}).format(carbon)} gCO2e`; + this.shadowRoot.getElementById("carbon").textContent = `${Intl.NumberFormat([],{ minimumFractionDigits: 3, maximumFractionDigits: 3}).format(carbon)} gCO2e`; this.store?.setItem("carbonara", JSON.stringify({transfer, duration: this.duration})); } } diff --git a/package.json b/package.json index 3f5dcf8..2ba944a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@digital4better/carbonara", - "version": "1.1.0", + "version": "1.1.1", "description": "A carbon footprint web component", "repository": { "type": "git",