Mirror: 🎩 A tiny but capable push & pull stream library for TypeScript and Flow
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix make source not being sync-safe

When the observer was called synchronously the
Start event wasn't yet sent to the Sink which
caused events to be missed. This swaps the order
of the call for safety.

+7 -5
+7 -5
src/sources/wonka_source_make.re
··· 1 1 open Wonka_types; 2 2 3 3 let make = f => curry(sink => { 4 - let teardown = f(.{ 5 - next: value => sink(.Push(value)), 6 - complete: () => sink(.End) 7 - }); 4 + let teardown = ref((.) => ()); 8 5 9 6 sink(.Start((.signal) => { 10 7 switch (signal) { 11 - | Close => teardown(.) 8 + | Close => teardown^(.) 12 9 | Pull => () 13 10 } 14 11 })); 12 + 13 + teardown := f(.{ 14 + next: value => sink(.Push(value)), 15 + complete: () => sink(.End) 16 + }); 15 17 });