How would you organize a large complex web application (see basic example)?

前端 未结 4 847
北荒
北荒 2020-12-22 18:19

Just to keep things interesting and close my final open question, the solution that implements the below functionality in a nicely organized manner with a decent architectur

4条回答
  •  情歌与酒
    2020-12-22 19:13

    I would either turn it in to a jQuery plugin or a static object.

    The static object just acts as a kind or wrapper. I would also break it up in to smaller functions e.g.

    init()
    checkLength()
    checkTime()
    

    So you might end up with something like:

    Widget = {
    
    init:function(){//setup events etc},
    checkLength:function(){},
    checkTime:function(){},
    doMessage:function(){}
    
    
    }
    

提交回复
热议问题