Robotjs: Implement callbacks

Created on 7 May 2015  路  6Comments  路  Source: octalmage/robotjs

I want to do something like

robot.moveMouseSmoothly(x, y, function(coordinates, oldCoordinates) {
  console.log('Done moving');
});

Would this be possible to do for all methods, so we can chain them properly, and so the methods are not blocking.

enhancement

Most helpful comment

Better if returns a promise, a callback that doesn't have err as first parameter is not standard and not yieldable :)

Looks like we have no err to report, and having always nil seems unnecessary

All 6 comments

This is probably way better than #14, it's the Node.js way to do things.

Thanks for the suggestion, I'll keep it in mind.

Better if returns a promise, a callback that doesn't have err as first parameter is not standard and not yieldable :)

Looks like we have no err to report, and having always nil seems unnecessary

I'm still not sure how I should handle this, but I think it would be best to use callbacks with a delay in the C code. This way the commands are chainable, the delay is non-blocking, and we won't run into any OS limitations.

callbacks :+1:

Will be this feature implemented in any future releases ?

Promises, async/await 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itsashis4u picture itsashis4u  路  10Comments

HopefulLlama picture HopefulLlama  路  3Comments

Glutch picture Glutch  路  6Comments

EdSaleh picture EdSaleh  路  8Comments

poojas2288 picture poojas2288  路  8Comments