官术网_书友最值得收藏!

What is a single-page app?

A single-page app implements this architecture for web clients: the JavaScript app launches from a web page and then runs entirely in the browser. All visual changes on the website happen as a reaction to user actions and the data received from the remote APIs.

It is called single-page because the server does not render pages for the client; it always delivers the same minimalistic markup required to bootstrap the JS app. All page rendering and navigation happens purely on the client, using JavaScript, which utilizes History APIs to dynamically swap page contents and URLs in the location bar.

The advantages that this approach gives are that the client can run something in the background between page transitions, and the client does not have to re-download and re-render the entire page in order to swap only the main content. Unfortunately, it also brings drawbacks, because now the client is responsible for all state changes. For the synchronization of such changes across the entire interface, it must know when to load the data and what particular data. In other words, a server-generated app is conceptually a way simpler thing, thanks to the REST service + JS client.

主站蜘蛛池模板: 额尔古纳市| 辉县市| 崇州市| 福鼎市| 海阳市| 德保县| 宁乡县| 亳州市| 裕民县| 锡林郭勒盟| 通江县| 兴和县| 玉溪市| 金溪县| 巴彦淖尔市| 赤城县| 德州市| 抚顺市| 游戏| 长春市| 太湖县| 涿鹿县| 玉屏| 长春市| 舟山市| 沙坪坝区| 石狮市| 福建省| 抚宁县| 余干县| 特克斯县| 桃江县| 云霄县| 西丰县| 绵竹市| 无棣县| 开平市| 宁德市| 清水河县| 翼城县| 柯坪县|