mirror of
https://github.com/re-rxjs/react-rxjs.git
synced 2025-12-08 18:01:51 +00:00
v0.3.0
This commit is contained in:
parent
60ae1705bd
commit
d84d7b643e
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@josepot/react-rxjs",
|
||||
"version": "0.3.0-alpha-1",
|
||||
"version": "0.3.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.3.0-alpha.1",
|
||||
"version": "0.3.0",
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@ -3,7 +3,6 @@ import { finalize } from "rxjs/operators"
|
||||
import { distinctShareReplay } from "./operators/distinct-share-replay"
|
||||
|
||||
const empty = Symbol("empty") as any
|
||||
const F = () => false
|
||||
export function createInput<T>(defaultValue: T = empty) {
|
||||
const cache = new Map<string, [Subject<T>, { latest: T }, Observable<T>]>()
|
||||
const getEntry = (key: string) => {
|
||||
@ -16,7 +15,7 @@ export function createInput<T>(defaultValue: T = empty) {
|
||||
}
|
||||
const source = subject.pipe(
|
||||
finalize(() => cache.delete(key)),
|
||||
distinctShareReplay(F),
|
||||
distinctShareReplay(),
|
||||
)
|
||||
result = [subject, current, source]
|
||||
cache.set(key, result)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user