rbrindley: branch 2.0 r4241 - /branches/2.0/developer_info/CODING-GUIDELINES

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Dec 1 10:10:51 CST 2008


Author: rbrindley
Date: Mon Dec  1 10:10:51 2008
New Revision: 4241

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4241
Log:

- added a javascript guideline about library mentality
- added a javascript guideline about window.onload functions in html pages


Modified:
    branches/2.0/developer_info/CODING-GUIDELINES

Modified: branches/2.0/developer_info/CODING-GUIDELINES
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/developer_info/CODING-GUIDELINES?view=diff&rev=4241&r1=4240&r2=4241
==============================================================================
--- branches/2.0/developer_info/CODING-GUIDELINES (original)
+++ branches/2.0/developer_info/CODING-GUIDELINES Mon Dec  1 10:10:51 2008
@@ -182,6 +182,17 @@
   (http://www.prototypejs.org), we should do what we can to follow their
   conventions.
 
+- Javascript code should be considered as libraries. Functions that can be
+  reused should reside in a file with the proper scope. For example, a
+  generic parsing function that could be used on any page should exist in 
+  index.js as opposed to only welcome.js. 
+
+- Javascript code should exist in a separate file located in config/js/ if
+  code is roughly 100 lines or longer, or used in multiple pages. The
+  exception to this guideline is any window.onload functions (for jQuery
+  this is $(document).ready()). These functions should remain in the html
+  file as they are considered to be custom for that page.
+
 - refrain from using 'onclick' and other associated html attributes. There
   is a wonderful thing called Event Delegation 
   (http://icant.co.uk/sandbox/eventdelegation/). This is a much faster




More information about the asterisk-gui-commits mailing list