yukatan / commangular

Command framework for AngularJS
MIT License
83 stars 8 forks source link

keep commands history feature #17

Closed weijyewang closed 8 years ago

weijyewang commented 8 years ago

Does commangular keep history for a list of commands that have been executed?

Bonus question: Any plans to implement authorization feature in the future? Example: Register a list of users that is authorized to be able to perform a set of commands based on namespace in .mapTo().

tjdownes commented 8 years ago

Commangular does not keep a history, but you could use Interception to implement this yourself, relatively easily. http://commangular.org/docs/#command-aspects

It's my opinion that the authorization feature you refer to should not be rolled into the framework, and can also be easily created using Interception. The author may or may not share this opinion with me, but I'd prefer Commangular to stay small and focused.

weijyewang commented 8 years ago

@tjdownes totally agree with you regarding the history. As for the authorization feature, I think it should be pre-configure during the config phase of angular life cycle, which suppose to happen before commangular.aspect().

yukatan commented 8 years ago

Hi, I'm the author of commangular and I'm totally agree with @tjdownes. The framework should be smallest as posible and focused. The idea is to manage commands and execution flows. The history feature is easy to implement using event and command aspects and I think it is the way to go. The same for the authorization feature. You can develop a @Before interceptor controlling what commands can be executed based on your conditions. You can build this features on top of commangular, but I think they are outside from the commangular scope.

weijyewang commented 8 years ago

@yukatan thanks for the idea. I will try to implement it