From 86d68fb7aabe7a4be791a98bac168e21ba84da1e Mon Sep 17 00:00:00 2001 From: Mikey Oz Date: Tue, 10 May 2022 14:23:56 -0700 Subject: [PATCH] add prefix to exported json --- app/client.imba | 2 +- app/utils/download.imba | 4 ++-- package.json | 2 +- sw.imba | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/client.imba b/app/client.imba index 86a9f25..bbf75b1 100644 --- a/app/client.imba +++ b/app/client.imba @@ -135,7 +135,7 @@ tag app loading_import = no def handle_click_export - download_json_file JSON.stringify(state.links) + download_json_file JSON.stringify(state.links), "fuzzyhome_" def handle_paste e return if state.query.length > 0 diff --git a/app/utils/download.imba b/app/utils/download.imba index 0c3a28d..c7250cb 100644 --- a/app/utils/download.imba +++ b/app/utils/download.imba @@ -4,10 +4,10 @@ def get_datetime_string let time = obj[4].split(":").join("-") "{date}_{time}" -export default def download_json_file data +export default def download_json_file data, prefix="" let element = document.createElement 'a' element.setAttribute 'href', 'data:text/plain;charset=utf-8,' + window.encodeURIComponent(data) - element.setAttribute 'download', "{get_datetime_string!}.json" + element.setAttribute 'download', "{prefix}{get_datetime_string!}.json" element.style.display = 'none' document.body.appendChild element element.click! diff --git a/package.json b/package.json index 088a80a..1ab8b6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fuzzyhome", - "version": "0.0.19", + "version": "0.0.20", "scripts": { "start": "imba run -SMH --baseurl . -w server.imba", "build-app": "imba build -SMH --baseurl . server.imba", diff --git a/sw.imba b/sw.imba index 0f6c6b0..2303799 100644 --- a/sw.imba +++ b/sw.imba @@ -1,7 +1,7 @@ let p = console.log const app_prefix = "fuzzyhome_cache" -const version = "0.0.19" +const version = "0.0.20" const cache_name = "{app_prefix}-{version}"