diff --git a/package.json b/package.json index 9b073a1..e48ea43 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "hammerjs": "^2.0.8", "ngx-electron": "^1.0.4", "rxjs": "^6.0.0", + "webstorage-decorators": "^1.0.3", "zone.js": "^0.8.26" }, "devDependencies": { diff --git a/src/app/formulaManager/formulaManager.component.ts b/src/app/formulaManager/formulaManager.component.ts index 6f45654..7d0bb8e 100644 --- a/src/app/formulaManager/formulaManager.component.ts +++ b/src/app/formulaManager/formulaManager.component.ts @@ -2,6 +2,7 @@ import {Component, ElementRef, ViewChildren, HostListener} from '@angular/core'; import {AngularFirestore} from 'angularfire2/firestore'; import {ConvertFromGPipe, ConvertToGPipe} from './units.pipe'; import {ElectronService} from 'ngx-electron'; +import {LocalStorage} from 'webstorage-decorators'; @Component({ selector: 'formula-manager', @@ -14,7 +15,8 @@ export class FormulaManagerComponent { formula; installPrompt; components; - unit = 'g'; + @LocalStorage({defaultValue: 'g'}) + unit; _newTotal: number = 0; get newTotal() { diff --git a/yarn.lock b/yarn.lock index 78e507b..37f09f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -417,6 +417,10 @@ version "0.7.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" +"@types/crypto-js@^3.1.39": + version "3.1.41" + resolved "https://registry.yarnpkg.com/@types/crypto-js/-/crypto-js-3.1.41.tgz#50727bd54f13991288d1aff66d1f6b6e68f7b2f3" + "@types/jasmine@*", "@types/jasmine@~2.8.6": version "2.8.8" resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.8.tgz#bf53a7d193ea8b03867a38bfdb4fbb0e0bf066c9" @@ -2134,6 +2138,10 @@ crypto-browserify@^3.11.0: randombytes "^2.0.0" randomfill "^1.0.3" +crypto-js@^3.1.9-1: + version "3.1.9-1" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.1.9-1.tgz#fda19e761fc077e01ffbfdc6e9fdfc59e8806cd8" + crypto-random-string@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" @@ -8745,6 +8753,13 @@ websocket-extensions@>=0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" +webstorage-decorators@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/webstorage-decorators/-/webstorage-decorators-1.0.3.tgz#8058eb130c2f0b34f103adc0b024e634b7d5a315" + dependencies: + "@types/crypto-js" "^3.1.39" + crypto-js "^3.1.9-1" + whatwg-fetch@2.0.4, whatwg-fetch@>=0.10.0: version "2.0.4" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"