codecamp

注释规范

注释规范

  1. 1、文件顶部注释(推荐使用)

    1
    2
    3
    4
    5
                               
    /*
    * @description: xxxxx中文说明
    * @author: zhifu.wang
    * @update: zhifu.wang (2012-10-17 18:32)
    */
                               
  2. 2、模块注释(推荐使用)

    1
    2
    3
                               
    /* module: module1 by zhifu.wang */

    /* module: module2 by zhifu.wang */
                               

    模块注释必须单独写在一行        

  3. 3、简单注释

  4.      3.1 单行注释

    1                            
    /* this is a short comment */                            

    单行注释可以写在单独一行,也可以写在行尾        

  5.       3.2 多行注释

    1
    2
    3
    4
                               
    /*
    * this is comment line 1.
    * this is comment line 2.
    */
                               

    多行注释必须写在单独行内        

  6. 4、特殊注释(推荐使用)

    1
    2
                               
    /* TODO: xxxx by zhifu.wang 2012-10-18 18:32 */
    /* BUGFIX: xxxx by zhifu.wang 2012-10-18 18:32 */
                               

    用于标注修改、待办等信息        

  7. 5、长度要求:注释中的每一行长度不超过40个汉字,或者80个英文字符


文件相关规范
排版规范
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }