From c81fe11e52a008a146271f191ef328c3a30a0a65 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Sun, 27 Nov 2022 13:05:44 +0100 Subject: [PATCH] Rename `Prism.changesWithoutValues()` to `onStale()` --- packages/dataverse/src/derivations/prism/prism.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/dataverse/src/derivations/prism/prism.ts b/packages/dataverse/src/derivations/prism/prism.ts index 687daa8..5f3f667 100644 --- a/packages/dataverse/src/derivations/prism/prism.ts +++ b/packages/dataverse/src/derivations/prism/prism.ts @@ -85,12 +85,16 @@ class PrismDerivation implements IDerivation { } /** - * Like {@link AbstractDerivation.changes} but with a different performance model. `changesWithoutValues` returns a `Tappable` that - * updates every time the derivation is updated, even if the value didn't change, and the callback is called without - * the value. The advantage of this is that you have control over when the derivation is freshened, it won't - * automatically be kept fresh. + * @deprecated This is renamed to {@link PrismDerivation.onStale}. */ changesWithoutValues(): Tappable { + return this.onStale() + } + + /** + * Returns a tappable that fires every time the prism's state goes from `fresh-\>stale.` + */ + onStale(): Tappable { return new DerivationValuelessEmitter(this).tappable() } @@ -98,7 +102,7 @@ class PrismDerivation implements IDerivation { * Keep the derivation hot, even if there are no tappers (subscribers). */ keepHot() { - return this.changesWithoutValues().tap(() => {}) + return this.onStale().tap(() => {}) } /**