Reputation: 25
While reading code on Flux, I found some lines I don't understand.
Source: https://github.com/facebook/flux/blob/master/src/Dispatcher.js
On line 109, the angle brackets
class Dispatcher<TPayload>
On line 110-115, the whole block doesn't look like javascript.
_callbacks: {[key: DispatchToken]: (payload: TPayload) => void};
_isDispatching: boolean;
_isHandled: {[key: DispatchToken]: boolean};
_isPending: {[key: DispatchToken]: boolean};
_lastID: number;
_pendingPayload: TPayload;
On line 138, the function with : void
before curly braces.
unregister(id: DispatchToken): void {
...}
I thing it is because of some kind of js library. But I'm not sure. The only trace I can find is that invariant is required for this js file. but I can't find the code or documents of invariant.
Upvotes: 1
Views: 329
Reputation: 3692
It isn't just Javascript (check out this line), it's flow.
Flow adds static type checking to Javascript code.
Specifically:
Upvotes: 2