Created
August 5, 2022 05:28
-
-
Save tpot/8abdc7e0364d5f9c8123840e63b0edeb to your computer and use it in GitHub Desktop.
Test stream creation in nbb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns stream-test | |
(:require [cljs.pprint :refer [pprint]] | |
["readable-stream" :as stream])) | |
(def number-stream | |
(new stream.Readable | |
#js{:objectMode true | |
:read (fn [count] (.push js/this 42))})) | |
(-> number-stream | |
(.on "data" (fn [chunk] (pprint (list "got" chunk)))) | |
(.on "error" (fn [err] (pprint (list "err" err))))) | |
;; ("err" #object[TypeError TypeError: Cannot read property 'push' of undefined]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment