Hi all, Here I have summarize the suggestions in code review for CEP Geo-dashboard.
[1]: Use hasOwnProperty(key) in for-in loop to make sure that the key you get is an actual property of an object, and doesn't come from the prototype. [2]: Declared JavaScript variables explicitly with var statement.(use `var` keyword within js functions to make variable local ) [3]: Associated methods to the object's prototype rather than defined into the object constructor. [4]: Eliminate using `JSON.stringify` when sending data through AJAX, instead set header attribute content type to application/JSON and send data as JSON [5]: Add auto-reconnect mechanism if connection to web-socket fails over the time.Gracefully handle when web-socket connection lost. [6]: Store speed history data in HTML5 local storage <http://www.w3schools.com/html/html5_webstorage.asp>,other than keeping them in JS array [7]: Use options object to load user specific dynamic content such as , path colors, number of speed history points need to be displayed and etc . [8]: Remove `breaks` when using `return` statement in switch. [9]: Use common pop-up template DOM to show pop-up message when click on markers rather than creating individual popups. [10]: Change JS method name to appropriate one (i.e `getTileServers` to `loadTileServers`) [11]: Use dotted line for object path section joins. [12]: Write method to convert `geoJSON.geometry.coordinates` standard to Leaflet.LatLng format (Swap Latitude Longitude in geoJSON.geometry.coordinates when use in Leaflet) [13]: Remove try catch block in SpatialObject#update method and use if condition to prevent getting exception [14]: Use log.info/log.debug when outputting errors rather than printing them. [15]: Change internal using jaggery library type(i.e commons.jag) to js and require them in appropriately. [16]: Use try catch finally when opening file [17]: Use master data sources XML when creating data-source object [18]: write mysql table creation script to create necessary mysql tables when initializing the geo-dashboard app. [19]: Use .json configuration files and require them in jaggery source, so that it will automatically parse the content and return a JSON object. Regards, KasunT
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
