fw4wdbIndexedDB 操作框架
fw4wdb是一个简单封装的 IndexedDB 操作框架支持get、put、getAll、each和range操作
<html> <head> <title>test</title> <script src=/static/js/fw4wdb.js></script> <script type="text/javascript"> (function(){ fw4wdb("test",1,{key:'code',index:[{name:{unique:true}}]}) .open(function(obj){ obj.put({code:1,name:'aa'}); obj.put({code:2,name:'cc'}); obj.put({code:4,name:'bb'}); obj.put({code:3,name:'dd'}); obj.put({code:5,name:'ee'}); obj.sort = 'next'; // 'prev' obj.range("name<cc",function(data){ //迭代结果 console.log(data); }); obj.close(); }); })(); </script> </head> <body> </body> </html>
评论