Skip to content

Commit e16692c

Browse files
committed
Removed multi-arg event handling. Fixes #25
1 parent ef7e182 commit e16692c

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kind: Changed
2+
body: Removed multi-argument event handling added in v16, which didn't actually work
3+
time: 2024-01-24T11:48:17.241035+11:00
4+
custom:
5+
GithubIssue: "25"

lib/js/test/module/EventEmitterTestLib.bs.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Event.res

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,29 @@
22
* The `Event` type represents the strings/symbols used in Node to
33
* identify event types for `EventEmitter` and its subclasses, including
44
* streams, sockets, and servers.
5-
*
5+
*
66
* Given a type signature `Event.t('a => 'b, 'ty)`, the first type
77
* variable, `'a => 'b`, denotes the type signature of the event listener
88
* function, and `'ty` denotes the type of the associated `EventEmitter`.
9-
*
9+
*
1010
* These abstract `Event.t` types must be passed to `EventEmitter`
1111
* functions to register event listeners or emit events. By encoding the
1212
* listener function type in a type variable, we can ensure that each
1313
* listener has the correct type. The type parameter for the emitter
1414
* prevents two different emitters from using each other's events.
15-
*
15+
*
1616
* While this gives us some degree of type safety, it is still possible
1717
* to introduce runtime errors with this API. In particular, two or more
1818
* `Event.t` types can be defined from the same string/symbol, but with
1919
* different listener types. Therefore, we strongly recommend using
2020
* 100% unique strings/symbols to define events.
21-
*
21+
*
2222
")
2323
type t<'listener, 'ty>
2424
external fromString: string => t<'a => 'b, 'ty> = "%identity"
25-
external fromString2: string => t<('a, 'b) => 'c, 'ty> = "%identity"
26-
external fromString3: string => t<('a, 'b, 'c) => 'd, 'ty> = "%identity"
2725
external fromSymbol: Js.Types.symbol => t<'a => 'b, 'ty> = "%identity"
28-
external fromSymbol2: Js.Types.symbol => t<('a, 'b) => 'c, 'ty> = "%identity"
29-
external fromSymbol3: Js.Types.symbol => t<('a, 'b, 'c) => 'd, 'ty> = "%identity"
3026
external unsafeToString: t<'a => 'b, 'ty> => string = "%identity"
31-
external unsafeToString2: t<('a, 'b) => 'c, 'ty> => string = "%identity"
32-
external unsafeToString3: t<('a, 'b, 'c) => 'd, 'ty> => string = "%identity"
3327
external unsafeToSymbol: t<'a => 'b, 'ty> => Js.Types.symbol = "%identity"
34-
external unsafeToSymbol2: t<('a, 'b) => 'c, 'ty> => Js.Types.symbol = "%identity"
35-
external unsafeToSymbol3: t<('a, 'b, 'c) => 'd, 'ty> => Js.Types.symbol = "%identity"
3628
type case =
3729
| String(string)
3830
| Symbol(Js.Types.symbol)

test/module/EventEmitterTestLib.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ module Emitter1 = {
77
let symbol: Event.t<Js.Types.symbol => unit, t> = Event.fromSymbol(uniqueSymbol)
88
let text: Event.t<string => unit, t> = Event.fromString("text")
99
let integer: Event.t<int => unit, t> = Event.fromString("integer")
10-
let textAndInteger: Event.t<(string, int) => unit, t> = Event.fromString2("textAndInteger")
1110
}
1211
}

0 commit comments

Comments
 (0)