acdlite / acdlite/flummox

Lower-level actions primitive

未關閉
#79 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement outdated
主要語言
JavaScript
星號
1.7k
分支
109
PR 合併指標
30 天內沒有已合併 PR

描述

At this point I'm really happy with Flummox's store API, its isomorphic capabilities, and its React integration story with FluxComponent. The one area that still feels like it needs some attention is actions.

The auto-dispatching and async stuff is solid. Speaking personally, it's super convenient and really avoids a lot of boilerplate. What I'm not sold on is the Actions class. It really only exists as a way to group actions together — which is convenient, but since one of Flummox's goals is to be highly extensible, I think a lower-level version of the same functionality should be provided.

`Flux#dispatch()` and `Flux.dispatchAsync()` already exist (though are undocumented) as a wrapper around the dispatcher. Theoretically this would be enough for a third-party library to build on top of. I think we can do better.

What I have in mind is a method `Flux#createAction(actionId, actionCreator)`. This accepts an action id (constant in Flux parlance) and an action creator function, and returns an action. (Terminology is a bit confusing here... need to clear up somehow.) The action creator works the same way as methods on an Actions subclass currently do: the return value is automatically dispatched, and functions that return promises are treated as async actions.

We could continue providing the Actions class as a convenience and re-implement it using `createAction()`. This would provide a better way for other modules/projects to build on top of Flummox and add custom behavior.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。