Sammy.js是一个微型的JavaScript框架用来简化JavaScript应用程序的编写,其核心只有16K,压缩后5.2K大小。
示例代码:
//initializetheapplicationvarapp=Sammy('#main',function(){ //includeaplugin this.use('Mustache'); //definea'route' this.get('#/',function(){ //loadsomedata this.load('posts.json') //renderatemplate .renderEach('post.mustache') //swaptheDOMwiththenewcontent .swap(); });});//starttheapplicationapp.run('#/');
评论