Agent.on(), device.on() is really hard to remember

Ok, I know this is silly, but I keep having to remind myself of what

agent.on() or device.on() does.

Maybe a more descriptive name:

agent.onEvent(“EventName”, function(msg){
});

agent.send is ok, although maybe agent.sendEvent(“EventName”, payload) would be more consistent.

Thoughts? I keep thinking device.on() was to check if a device was on.

Me too, I think going forward we might not be in a minority.
Also you can use imp.wakeup() in an Agent, I’m sure will cause more confusion.

The intention was that the first parameter is read as part of the name:
device.on("overheat",...)
is the “on overheat” event-handler.

Peter

Yeah, I agree that part is neat, but tough to remember. That being said, we use it enough, and it will all click.

A little auto-complete might go a long way here, I guess.