Are SPAs (Single Page Applications) suitable for sites aimed for mobiles?

前端 未结 8 1356
野趣味
野趣味 2021-01-31 03:27

I am planning to create a website with around different 20 views/pages primary for mobile phones.

If I want to focus on a making the user experience very responsive (as

8条回答
  •  广开言路
    2021-01-31 03:40

    Keep it simple -

    Yes Single Page Applications are a perfect fit for mobile development. SPA Frameworks such as Durandal, Angular, Backbone, Ember, etc... need only a JavaScript engine to run effectively. They are cross-browser compatible and require nothing special to operate on each individual screen size, resolution, or device, and take advantage of mobile devices' powerful engines.

    What makes them so well-suited?

    With a single-page application you can put all of the hooks in place for declarative two-way data-binding with libraries such as Knockout, Handlebars or Angular that will replace all of the jQuery DOM manipulation that you would use in traditional web site. This will promote re-usable components such as Directives and Custom Binding Handlers that reduces the amount of code needed and allows for easier testing, since the bindings will be re-used through out your application.

    What makes them not so good for mobile?

    Single Page Applications can often start down a path of poor design that will be hard to recover from (like any other development) The difference is that it is hard to find a great path to take for creating a scalable application and often first time SPA developers make assumptions. This can alleviated by taking advantage of resources (such as paid support, StackOverflow, etc...) or by performing heavy code-review up front around the foundation of your SPA

    What about performance?

    Single page applications are lightning fast in most cases. The basic idea is using dependency injection and libraries like Require.js for loading AMD modules allows the developer to only require the clients to download the HTML and JavaScript files rarely when changes occur. By loading from cache you are essentially reducing your hits to the server to data calls. This follows RESTful web development techniques.

提交回复
热议问题