5 Commits

Author SHA1 Message Date
Josh Creek c51fca8425 chore(#12): Update package version 2022-10-08 17:25:01 +01:00
Josh Creek 866346ea01 fix(#12): Fix empty lines being added to spinner 2022-10-08 17:24:49 +01:00
Josh Creek 050f87301c Merge pull request #13 from jcreek/1-add-state-to-localstorage
1 add state to localstorage
2022-10-08 17:20:26 +01:00
Josh Creek 39d4ded1fb chore(#1): Update version number 2022-10-08 17:19:00 +01:00
Josh Creek eff426550b feat(#1): Add state to localstorage 2022-10-08 17:17:41 +01:00
2 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "SelectionWheel", "name": "SelectionWheel",
"version": "1.2.0", "version": "1.3.1",
"description": "A fun and simple selection wheel.", "description": "A fun and simple selection wheel.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
+10 -1
View File
@@ -182,7 +182,7 @@ function startOver() {
function startSpinning() { function startSpinning() {
const textArea = <HTMLInputElement>document.getElementById('input-lines'); const textArea = <HTMLInputElement>document.getElementById('input-lines');
const inputData = textArea.value.trim() const inputData = textArea.value.trim()
? textArea.value.split('\n') ? textArea.value.split('\n').filter((elm) => elm)
: testData; : testData;
const tempData = []; const tempData = [];
for (let index = 0; index < inputData.length; index += 1) { for (let index = 0; index < inputData.length; index += 1) {
@@ -228,6 +228,15 @@ function startSpinning() {
const button = document.getElementById('startSpinning'); const button = document.getElementById('startSpinning');
button.onclick = startSpinning; button.onclick = startSpinning;
const textArea = <HTMLInputElement>document.getElementById('input-lines');
if (window.localStorage.TextEditorData) {
textArea.value = window.localStorage.TextEditorData;
}
textArea.addEventListener('keyup', () => {
window.localStorage.TextEditorData = textArea.value;
});
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
loadServiceWorker(); loadServiceWorker();
} }