···
[@genType.import "../shims/Js.shim"]
type observableSubscriptionT = {. [@bs.meth] "unsubscribe": unit => unit};
16
+
external subscription_set: (observableSubscriptionT, string, bool) => unit;
[@genType.import "../shims/Js.shim"]
type observableObserverT('a) = {
···
33
-
(observableT('a), string) => option(observableFactoryT('a)) =
36
+
(observableT('a), string) => option(observableFactoryT('a));
external observable_unsafe_get:
37
-
(observableT('a), string) => observableFactoryT('a) =
39
+
(observableT('a), string) => observableFactoryT('a);
41
-
(observableT('a), string, unit => observableT('a)) => unit =
42
+
(observableT('a), string, unit => observableT('a)) => unit;
let fromObservable = (input: observableT('a)): sourceT('a) => {
···
88
-
(observer: observableObserverT('a)): observableSubscriptionT => {
88
+
(_observer: observableObserverT('a)): observableSubscriptionT => {
89
+
let next: (. 'a) => unit = [%raw
91
+
(typeof _observer === 'object' ? _observer.next : _observer) || function () {}
95
+
let complete: (. unit) => unit = [%raw
97
+
(typeof _observer === 'object' ? _observer.complete : arguments[2]) || function () {}
let state: observableStateT = {
talkback: talkbackPlaceholder,
···
| Push(x) when !state.ended =>
105
-
observer##complete();
112
-
pub unsubscribe = () =>
113
-
if (!state.ended) {
114
-
state.ended = true;
115
-
state.talkback(. Close);
125
+
pub unsubscribe = () =>
126
+
if (!state.ended) {
127
+
self->subscription_set("closed", false);
128
+
state.ended = true;
129
+
state.talkback(. Close);
133
+
subscription->subscription_set("closed", false);