rodux
rodux copied to clipboard
Expose store `ACTION_LOG_LENGTH` as a user-settable param, and add a `:clearLog` method to the store
At times, it is useful to know what actions were successfully applied to a store (e.g. to fire highly specific listeners that correspond to specific actions). At present, however, the action log is very limited and of fixed length. It would be useful if there was a way to change the log length, and also clear the log if needed.
Each item can be implemented in the following (correct me if I'm wrong):
For ACTION_LOG_LENGTH:
-
ACTION_LOG_LENGTHis no longer a localized variable and becomes a value in theStoretable, the one returned in the module. The user can set it withStore.ACTION_LOG_LENGTH = X, or with a setter function,Store.setActionLogLength`. - It becomes unique to each
Storeobject. The user sets it likeStore:setActionLogLength() / Store.setActionLogLength(store), andself._actionLogLengthbecomes a thing.
For Store:clearLog() / Store.clearLog(store):
- A function
Store.clearLogthat setsself._actionLogto an empty table.
I am unfamiliar with Rodux's ecosystem, so there might be another step in clearing the log, such as cleaning up connections.