From 396fbd7ede9bde73fa4c35193acdf79b3375a7a1 Mon Sep 17 00:00:00 2001 From: pushkine Date: Wed, 15 Apr 2020 16:41:18 +0200 Subject: [PATCH] comments --- src/runtime/store/index.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/runtime/store/index.ts b/src/runtime/store/index.ts index 80c7a5e8e0..0c195046b2 100644 --- a/src/runtime/store/index.ts +++ b/src/runtime/store/index.ts @@ -135,11 +135,7 @@ export function derived(store: SingleStore, controller: DeriverController): StartStopNotifier => set => { const unsub = subscribe(store, value => controller.update(value, set)); return function stop() { @@ -147,7 +143,7 @@ const single = (store: SingleStore, controller: DeriverController): StartStop }; }; -/** derived store StartStopNotifier function when given an array of stores */ +/** derived StartStopNotifier when given an array of stores */ const multiple = (stores: ArrayStore, controller: DeriverController): StartStopNotifier => set => { const values = new Array(stores.length); let pending = 1 << stores.length; @@ -178,9 +174,7 @@ const multiple = (stores: ArrayStore, controller: DeriverController): StartSt /** * mode "auto" : function has <2 arguments - * - * derived value = value returned by the function - * + * the derived value is the value returned by the function */ const auto = (fn: AutoDeriver): DeriverController => ({ update(payload, set) { @@ -191,11 +185,10 @@ const auto = (fn: AutoDeriver): DeriverController => ({ /** * mode "manual" : function has >1 arguments + * [(...args) does not count as an argument] * - * derived value = value set manually - * before each update => callback returned by the function - * - * note : [(...args) does not count as an argument] + * derived value is a value set() manually + * if a callback is returned it is called on next update */ const manual = (fn: ManualDeriver): DeriverController => ({ update(payload, set) {