2.0.0 • Published 7 years ago

magix-updater v2.0.0

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

magix-updater Version Number License download

npm install magix-updater

简介

局部刷新解决方案

使用

需要配合magix-combine工具

index.html

<div>
    <%=a%>~~<%=b%>
</div>

<ul>
    <%for(var i=0;i<list.length;i++){%>
        <li> <%=list[i]%> </li>
    <%}%>
</ul>

index.js

var updater = new Updater('app', 'magix@index.html');
var list = [1, 2, 3, 4, 5];
setInterval(function() {
    updater.set({
        a: Math.random(),
        b: Math.random(),
        list: list
    }).digest();
    list = list.reverse();
}, 2000);

以后a,b有变化时,只需要set a,b即可

如果更新到界面需要调用digest方法。

2.0.0

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago