Consideration of the page state management

problem

  1. The need for a dedicated management api state?

    See a large part of the assembly code is in the modified state, or other state is provided according to some state. This change of state, accounting for most of the code.

 

The front end is simply dom = fn (data)

And it can be roughly divided into four types of code:

  1. Ajax request

  2. Calculate: Another data calculation A data

  3. Change Status: initialization, according to the results of the request to modify Ajax, modified according to the results, according to other modified state

  4. Template: reading state is displayed

Ajax request and obtain one combination calculation stateless layer api

Changing the state of the logic and api layer obtained stateless combine layer stateful api

Template and api stateful binding layer assembly to give

Guess you like

Origin www.cnblogs.com/yoyogis/p/11201343.html