javascript - Manage multiple scripts on single page application -
i developing single page phonegap application. using own custom logic (not using single page library).
it have functionalities web service accessing , online - offline syncing , other phonegap features.
i have 100 views , code. came across confusion, best solution achieve this.
i generate html templates stored on main html page. remove view's html when swapping between views.
1) merge code in single js file.
- it may causes memory leak, , large amount of objects included in single js file.
2) add/remove script tag dynamically
split application logic in view wise js files , dynamically add/remove script tag using jquery.
also remove dom event listeners added.
i suggest using backbone.js , underscore.js project.
you can learn backbone.js here. http://backbonetutorials.com/
Comments
Post a Comment