#目前的特点
DOMSnap API 非常简洁,
capture
和resume
分别负责持久化快照和恢复支持同一个元素保存多份快照
支持 watch 的方式自动保存快照
支持预先快照, 在用户没有产生相应交互之前就离线相应的页面结构以增加交互的流畅性
支持自定义快照, 方便 SPA 类 Web App 将快照与路由对应
支持作用域, 同一个域名下不同项目不会冲突
支持版本控制, 页面改版后不会冲突
#使用方法
方式 1. 页面中引入脚本
<script src="DOMSnap.min.js"></script>
方式 2. 安装包
npm install --save domsnap
然后包含到你的模块中
var DOMSnap = require('domsnap');
Examples
//init DOMSnapvar DS = DOMSnap(function(){ console.log('DOMSnap is ready');
});//capture snapshot html of #mainDS.capture('#main');//capture with specified capture idDS.capture('#main','my_id');//set the html of #main by it's captured snapshot htmlDS.resume('#main');//set by specified capture idDS.resume('#main','my_id');