js object: how to receive (and distinguish) bang messages from multiple inlets

Antonio Alcorn's icon

Hello!

I've created a js object with 2 inlets. I'd like to be able to receive bang messages through either inlet, and be able to distinguish which inlet the bang came from. This is so I can connect one to the output of a metro object, and use the other for different control purposes.

Any hints?

Andrew Pask's icon

inlets = 2;

function bang()
{
post("bang");
post("came in on ",inlet);
}

Cheers

-A

Antonio Alcorn's icon

Thank you!

For anyone else wondering where this fits conceptually, I found from the documentation that inlet is a built-in property of the jsthis object in the context of a function triggered by an incoming message.