[英]I don't understand some syntax in Dispatcher.js in Flux
While reading code on Flux, I found some lines I don't understand. 在Flux上阅读代码时,我发现了一些我不理解的行。
Source: https://github.com/facebook/flux/blob/master/src/Dispatcher.js 来源: https : //github.com/facebook/flux/blob/master/src/Dispatcher.js
On line 109, the angle brackets 在第109行,尖括号
class Dispatcher<TPayload>
On line 110-115, the whole block doesn't look like javascript. 在第110-115行,整个块看起来都不像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. 在第138行,花括号前带有: void
的函数。
unregister(id: DispatchToken): void { ...}
I thing it is because of some kind of js library. 我的东西是因为某种js库。 But I'm not sure. 但是我不确定。 The only trace I can find is that invariant is required for this js file. 我只能找到的唯一跟踪是此js文件需要不变。 but I can't find the code or documents of invariant. 但我找不到不变式的代码或文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.