Skip to content

Commit

Permalink
testing soft delete
Browse files Browse the repository at this point in the history
  • Loading branch information
thejavierCO committed Aug 1, 2024
1 parent 0d26fbb commit 65fd719
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
27 changes: 18 additions & 9 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
import Background from "./Components/background.svelte";
import Store from "./Components/Db Components/store.svelte";
import Counter from "./Components/Timer Components/timer.svelte";
import { configApi, catImage } from "./js/store";
import { catImage } from "./js/store";
export let config;
configApi.set(config || {});
</script>

<Store
let:add
let:edit
let:del
useLocalStorage
on:mount={async ({ detail: { add, store } }) => {
if (store().length === 0) {
catImage.subscribe(async (data) => {
catImage(config).then((url) => {
add({
status: "Stop",
seconds: 86400,
seconds: 25, //86400,
time: { start: 0, end: 0, pause: 0 },
img: await data,
img: url,
});
});
} else console.log("first");
}
}}
>
<div slot="print" let:id let:data let:index>
Expand All @@ -31,9 +31,18 @@
status={data.status}
time={data.time}
let:formatTime
on:state={({ detail }) => {
if (detail.status == "Stop") del(id);
edit(id, detail);
on:state={async ({ detail: { data, Counter } }) => {
edit(id, data);
console.log(Counter);
// catImage(config).then((url) => {
// add({
// status: "Stop",
// seconds: 10, //86400,
// time: { start: 0, end: 0, pause: 0 },
// img: url,
// });
// });
if (data.status == "Stop") del(id);
}}
>
<div>
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Timer Components/timer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
let posicion = Counter.formatTime;
Counter.on("current_status_timer", ({ detail }) => {
if (status != detail.status) emit("state", detail);
if (status != detail.status) {
emit("state", { data: detail, Counter });
}
if (status == "Play") posicion = Counter.formatTime;
});
Expand Down

0 comments on commit 65fd719

Please sign in to comment.