XML Feeds

.

[javascript-dev] Re: distinguishing between inlets

Emmanuel Jourdan c74-mailinglists at e--j.com
Mon May 19 06:47:36 MDT 2008


On 19 mai 08, at 14:29, Glen wrote:

>
> The reason the manual isn't helping me is because it states  
> [b]inlet(no, get)[/b] yet inlet is not a function
>
> it also [i]implies[/i] using msg_int(a, b, c..) and this happens:
>
> function msg_int(a, b){
> post(a); // will output a or b
> post(b); // nothing
> }


if you send a list to your js object you need to use a list function

function list(a, b)
{
	post(a);	// first list item
	post(b);	// second list item
}

To know from which inlet a message arrived in your js, you need to  
look at the inlet property (a variable). So:

inlets = 2;	// define the number of outlets of your js object

function msg_int(v)
{
	if (inlet == 1)	// second inlet
		post(v, " was received in the second inlet\n");
	else
		post(v, "was received in the left inlet\n");
}

HTH,
ej




More information about the javascript-dev mailing list