javascript - Backbone.js and PhoneGap, single or multi page? - Stack Overflow

What I'm trying to do is build a simple app in PhoneGap and Backbone.js.The app has a login page

What I'm trying to do is build a simple app in PhoneGap and Backbone.js. The app has a login page which, on a successful login, sends the user to a simple menu with a few options. The user has the option to view their saved lists, view a list of items or view an info page. I know how I want to structure all of the Views and Models so the question I have is whether or not doing this all on one page has any downsides when pared to using multiple pages.

To break it down into smaller parts:

  1. Does loading all the javascript in the one page have serious performance implications?
  2. If the router closes, .remove() and .unbind(), all the current view when switching to a new view, do I still risk memory issues?

What I'm trying to do is build a simple app in PhoneGap and Backbone.js. The app has a login page which, on a successful login, sends the user to a simple menu with a few options. The user has the option to view their saved lists, view a list of items or view an info page. I know how I want to structure all of the Views and Models so the question I have is whether or not doing this all on one page has any downsides when pared to using multiple pages.

To break it down into smaller parts:

  1. Does loading all the javascript in the one page have serious performance implications?
  2. If the router closes, .remove() and .unbind(), all the current view when switching to a new view, do I still risk memory issues?
Share Improve this question asked Aug 29, 2012 at 15:17 Jdeer_KKullenJdeer_KKullen 731 silver badge4 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Backbone was designed to be built for SPA applications. Im not saying that you can't span Backbone over multiple pages, but in my opinion that adds more plexity. From your description, I would keep your application as an SPA.

Secondly, build your application using modules. Use a library such as require.js. I could not remend it enough. I wont go into too much detail about why you should use it, because you can read more about it here (I would remend reading the entire book). Once your application is ready for deployment, you can use r.js, require.js's build script. This will concatenate all or some of your modules into a single file. This will drastically speed up the performance of your app especially if you have a bunch of modules.

Finally with regards to memory optimization, I use a method developed by Derick Bailey which you can read up about here.

Hope this helps.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744988509a4604758.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信