From 39752a4584d1b157a8d72c47722a39676214a133 Mon Sep 17 00:00:00 2001 From: voscausa Date: Tue, 23 Mar 2021 14:17:30 +0100 Subject: [PATCH] delta setter --- .vscode/settings.json | 2 ++ src/query.js | 6 +++--- src/stores.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/src/query.js b/src/query.js index d00441b..d80716e 100644 --- a/src/query.js +++ b/src/query.js @@ -19,9 +19,9 @@ export function query(from = 0, delta = 1) { return { subscribe: counter.subscribe, - update: (delta) => { + set delta(value) { clearInterval(interval); - interval = timer(delta); - }, + interval = timer(value); + } } } diff --git a/src/stores.js b/src/stores.js index 0a08cc9..a16dcc9 100644 --- a/src/stores.js +++ b/src/stores.js @@ -17,7 +17,7 @@ export const stream = vcDerived([from, delta], ([$from, $delta, fired], set) => unsubscribe = qry.subscribe(set); } else { console.log('callback: query update counter stream delta', $delta, 'fired:', fired); - qry.update($delta) + qry.delta = $delta; } // cleanup / stop return (fired) => { // fired: null or store_id (pending)