General information about events and commands of the highway / puppets

Can someone clarify the correct use of events and commands with the following logging and logging example?

The typical application that I need for

  • show registration form
  • complete registration
  • show success page

and

  • display login form
  • sign in
  • handle successful login

How can this be compared with the events of the Backbone network / Puppets?

How can this be compared with the WreqR commands?

I struggle with event names:

eg. onShowSignUp :

Isn't this an event that should be fired AFTER the registration form appears? How should the event calling the showSignUpForm or showLoginForm function showSignUpForm showLoginForm ?

+4
source share
1 answer

Events and commands are designed to decouple the modules from each other.

Module A does not explicitly know about module B, it only generates an event on application.vent , for example, to register, then module B listens for this event and redirects the browser page to success.

The same with the commands, but more suitable for the situation when you need some information to continue, for example, after a successful login, when you find out the name of the user who is logged in. If you do not want to obtain user credentials, register the command in module A, and then modules B and C can restore it from its specific implementation.

+1
source

Source: https://habr.com/ru/post/1501173/


All Articles