html-patcher
带有 HTML 模板的虚拟 DOM 差异和补丁。 基于上
安装
$ npm install html-patch
用法
一个简单的应用程序,每秒显示纪元时间:
var patcher = require ( 'html-patcher' )
var patch = patcher ( document . body , render ( ) ) ;
setInterval ( function ( ) {
patch ( render ( ) )
} , 1000 ) ;
function render ( ) {
return '<h1>' + Date . now ( ) + '</h1>' ;
}
有关更多信息,请参阅test.js