I was looking at Flux's Dispatcher.js source.
class Dispatcher <TPayload > {
_callbacks:{[key:DispatchToken]:(payload:TPayload)=>void};
<TPayload>
and _callbacks:{[key:DispatchToken]:(payload:TPayload)=>void};
In addition to the above,
register(callback:(payload:TPayload)=>void): DispatchToken{
I saw a way of writing like this, but what kind of notation is this?
javascript redux
The Dispatcher.js says @flow
, so it is JS type annotated by flow
The <TPayload>
part defines the Dispatcher
class with parameters and names the parameter TPayload
( class ).
_callbacks:{[key:DispatchToken]:(payload:TPayload)=>void}
declares the _callbacks
member type as key-value
© 2024 OneMinuteCode. All rights reserved.