小编art*_*zub的帖子

在客户端js中使用缓存数据的最佳方法是什么?

我的应用程序使用具有有限数量请求的API从另一台服务器接收数据.数据变化很少,但即使刷新页面后也可能需要.

  1. 使用cookie或HTML5 WebStorage,这个问题的最佳解决方案是什么?
  2. 并可能有其他方法来解决这个任务?

javascript cookies html5 web-storage

10
推荐指数
2
解决办法
2万
查看次数

在Delphi OLEDB中加密SQLite数据库

如果我使用SQLite ODBC Driver,如何在Delphi中使用加密到SQLite DB .
我必须使用ADO组件进行数据访问.

delphi sqlite encryption odbc ado

4
推荐指数
1
解决办法
1684
查看次数

如何在画布JS上优化绘制很多元素?

我有很多元素和mousemove方法,当选择一个项目时会重绘画布.

function redraw(ctx) { // ctx - canvas context
    if (!needRedraw) 
        return;
    ctx.save();
    ctx.clearRect(0, 0, w, h);
    drawItems(ctx);
    ctx.restore();
}

function drawItems(ctx) {
    var l = nodes.length(); // array of elements for drawing (from 100 to 100000)
    for(var i = 0; i < l; i++) {
        var item = nodes[i];
        ctx.beginPath();
        ctx.strokeStyle = colors(item.type);
        ctx.fillStyle = fill(item);
        ctx.arc(item.x, item.y, item.r, 0, Math.PI * 2, true);
        ctx.fill();
        ctx.stroke();
        ctx.closePath();
    }
}
Run Code Online (Sandbox Code Playgroud)

如何优化这个过程,因为它贯穿了这个非常昂贵的所有元素?可能是使用异步方法,但我不明白如何应用他?

javascript canvas html5-canvas

1
推荐指数
1
解决办法
1040
查看次数