Comparing version 0.2.0 to 0.2.1
@@ -0,13 +1,24 @@ | ||
import { Event as Event_2 } from 'effector'; | ||
import { EventCallable } from 'effector'; | ||
import { Observable } from 'rxjs'; | ||
import { Store } from 'effector'; | ||
declare type Input<D, S, U> = { | ||
declare type Input<D> = { | ||
source: Observable<D>; | ||
subscribeOn: EventCallable<S>; | ||
unsubscribeOn: EventCallable<U>; | ||
target: EventCallable<D> | EventCallable<void>; | ||
subscribeOn: Event_2<unknown>; | ||
unsubscribeOn: Event_2<unknown>; | ||
target: EventCallable<D>; | ||
}; | ||
export declare const rxSample: <D, S, U>({ source, subscribeOn, unsubscribeOn, target, }: Input<D, S, U>) => void; | ||
declare type InputWithStore<D> = { | ||
source: Store<Observable<D>>; | ||
subscribeOn: Event_2<unknown>; | ||
unsubscribeOn: Event_2<unknown>; | ||
target: EventCallable<D>; | ||
}; | ||
export declare function rxSample<D>(config: Input<D>): void; | ||
export declare function rxSample<D>(config: InputWithStore<D>): void; | ||
export { } |
@@ -1,28 +0,38 @@ | ||
import { createStore as u, createEffect as o, sample as c } from "effector"; | ||
const p = ({ | ||
source: s, | ||
subscribeOn: a, | ||
unsubscribeOn: n, | ||
target: b | ||
}) => { | ||
const t = u(null), r = o( | ||
() => s.subscribe(b) | ||
), l = o((e) => { | ||
e.unsubscribe(); | ||
import { createStore as s, is as x, attach as l, scopeBind as d, sample as c } from "effector"; | ||
function z({ | ||
source: t, | ||
subscribeOn: n, | ||
unsubscribeOn: u, | ||
target: f | ||
}) { | ||
const r = s(null, { | ||
serialize: "ignore" | ||
}), a = x.store(t) ? t : s(t, { serialize: "ignore" }), o = l({ | ||
source: r, | ||
effect: (e, g) => { | ||
e == null || e.unsubscribe(); | ||
const m = d(f, { safe: !0 }); | ||
return g.subscribe(m); | ||
} | ||
}), b = l({ | ||
source: r, | ||
effect: (e) => { | ||
e == null || e.unsubscribe(); | ||
} | ||
}); | ||
c({ | ||
clock: a, | ||
clock: [n, a], | ||
source: a, | ||
target: o | ||
}), c({ | ||
clock: o.doneData, | ||
target: r | ||
}), c({ | ||
clock: r.doneData, | ||
target: t | ||
}), c({ | ||
clock: n, | ||
source: t, | ||
filter: (e) => !!e, | ||
target: l | ||
clock: u, | ||
source: r, | ||
target: b | ||
}); | ||
}; | ||
} | ||
export { | ||
p as rxSample | ||
z as rxSample | ||
}; |
{ | ||
"name": "rx-sample", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -58,8 +58,15 @@ # rx-sample | ||
```ts | ||
type Input<D, S, U> = { | ||
type Input<D> = { | ||
source: Observable<D>; | ||
subscribeOn: EventCallable<S>; | ||
unsubscribeOn: EventCallable<U>; | ||
target: EventCallable<D> | EventCallable<void>; | ||
subscribeOn: Event<unknown>; | ||
unsubscribeOn: Event<unknown>; | ||
target: EventCallable<D>; | ||
}; | ||
type InputWithStore<D> = { | ||
source: Store<Observable<D>>; | ||
subscribeOn: Event<unknown>; | ||
unsubscribeOn: Event<unknown>; | ||
target: EventCallable<D>; | ||
}; | ||
``` | ||
@@ -66,0 +73,0 @@ |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
7007
60
101