I'm creating analytic application for Microsoft Surface. Application should be able to collect data in array from MS stylus while drawing (now I'm using HTML5 canvas
).
I'm using electron to make it desktop, for stylus data collection HTML5 Pointer Events API
.
So, there is now event listener, which fires when stylus is moved on the canvas
canvas.addEventListener("pointermove", collectData, false);
And collectData(event)
function looks like:
function collectData(event) {
array.push({
a: event.tiltX,
l: event.tiltY,
p: event.pressure,
t: Date.now()
});
}
The problem is, that this event listener fires about 70 times per second and for me it seems like performance limit. For my purposes this value is incredibly small, I'd like to increase this value twice or even more.
Is there any way to increase it or maybe there is another more efficient way to collect data from stylus in JS?