Rename Prism.changesWithoutValues()
to onStale()
This commit is contained in:
parent
a71fff0c73
commit
c81fe11e52
1 changed files with 9 additions and 5 deletions
|
@ -85,12 +85,16 @@ class PrismDerivation<V> implements IDerivation<V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like {@link AbstractDerivation.changes} but with a different performance model. `changesWithoutValues` returns a `Tappable` that
|
* @deprecated This is renamed to {@link PrismDerivation.onStale}.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
changesWithoutValues(): Tappable<void> {
|
changesWithoutValues(): Tappable<void> {
|
||||||
|
return this.onStale()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a tappable that fires every time the prism's state goes from `fresh-\>stale.`
|
||||||
|
*/
|
||||||
|
onStale(): Tappable<void> {
|
||||||
return new DerivationValuelessEmitter(this).tappable()
|
return new DerivationValuelessEmitter(this).tappable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +102,7 @@ class PrismDerivation<V> implements IDerivation<V> {
|
||||||
* Keep the derivation hot, even if there are no tappers (subscribers).
|
* Keep the derivation hot, even if there are no tappers (subscribers).
|
||||||
*/
|
*/
|
||||||
keepHot() {
|
keepHot() {
|
||||||
return this.changesWithoutValues().tap(() => {})
|
return this.onStale().tap(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue