2019-03-20 关于FSA--- Flux Standar

2019-03-20  本文已影响0人  KingAmo

什么是FSA?

FSA 是 Flux Standard Action 的缩写,是一个编写 action 的标准 (当然redux中也可以用)。
GitHub 介绍:flux-standard-action

符合FSA标准的action必须

还可以(optional

符合FSA标准的action不能有除了type, payload, error, meta 以外的属性。

type

type 必须是 String 类型的常量。

payload

The optional payload property MAY be any type of value. It represents the payload of the action. Any information about the action that is not the type or status of the action should be part of the payload field.

By convention, if error is true, the payload SHOULD be an error object. This is akin to rejecting a promise with an error object.

error

The optional error property MAY be set to true if the action represents an error.

An action whose error is true is analogous to a rejected Promise. By convention, the payload SHOULD be an error object.

If error has any other value besides true, including undefined and null, the action MUST NOT be interpreted as an error.

meta

The optional meta property MAY be any type of value. It is intended for any extra information that is not part of the payload.

Library

这两个库通常结合起来使用

上一篇 下一篇

猜你喜欢

热点阅读