单页JavaScript Web应用程序的体系结构? [英] Architecture of a single-page JavaScript web application?

查看:122
本文介绍了单页JavaScript Web应用程序的体系结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在客户端上构建一个复杂的单页JS Web应用程序?具体来说,我很好奇如何根据模型对象,UI组件,任何控制器和处理服务器持久性的对象来清理应用程序。

How should a complex single-page JS web application be structured on the client-side? Specifically I'm curious about how to cleanly structure the application in terms of its model objects, UI components, any controllers, and objects handling server persistence.

MVC看起来像首先适合但是,UI组件嵌套在各种深度(每个都有自己的方式对模型数据执行/反应,并且每个生成它们自己可能或可能不直接处理的事件),似乎并不像MVC那样被干净地应用。 (但如果不是这样,请更正我。)

MVC seemed like a fit at first. But with UI components nested at various depths (each with their own way of acting on/reacting to model data, and each generating events which they themselves may or may not handle directly), it doesn't seem like MVC can be cleanly applied. (But please correct me if that's not the case.)

-

这个问题导致了两个使用ajax的建议,这显然是除了最简单的一页应用程序)

(This question resulted in two suggestions of using ajax, which is obviously needed for anything other than the most trivial one-page app.)

推荐答案

MVC架构 PureMVC / JS 是最优雅的IMO。我从中学到了很多东西。我还发现Nicholas Zakas的可扩展JavaScript应用架构有助于研究客户端架构选项。

MVC architecture of PureMVC/JS is the most elegant IMO. I learned a lot from it. I also found Scalable JavaScript Application Architecture by Nicholas Zakas helpful in researching client side architecture options.

另外两个提示


  1. 我发现了视图,焦点和输入管理是单页网页应用程序中需要特别注意的领域。

  2. 我也发现抽出JS库有助于改变头脑中的所有内容,或者混合使用。匹配应该需要。

这篇关于单页JavaScript Web应用程序的体系结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆