[javascript-dev] Re: [sharingisfun] js based change filter
Emmanuel Jourdan
c74-mailinglists at e--j.com
Thu Sep 6 17:02:23 MDT 2007
- Previous message: [javascript-dev] Re: [sharingisfun] js based change filter
- Next message: [javascript-dev] Re: [sharingisfun] js based change filter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 6 sept. 07, at 23:17, Emmanuel Jourdan wrote:
> anything allows you to receive any message. For example, if you
> send an integer and the msg_int method is not defined, the anything
> function will be triggered. This is espacially useful for symbols
> as it's not possible to think about every symbol you could send.
Maybe an example will make it clearer, to achieve the changeany you
could have only use the anything method:
var lastThing = new Array();
function anything()
{
var i;
var tmp = arrayfromargs(messagename, arguments); // make an array
from the message
var isDifferent = false;
if (lastThing.length == tmp.length) {
for (i = 0; i < tmp.length; i++)
if (lastThing[i] != tmp[i]) {
isDifferent = true;
break;
}
} else
isDifferent = true;
if (isDifferent) { // it has changed
outlet(0, tmp);
lastThing = arrayfromargs(messagename, arguments); // it's easier
to call arrayfromargs again to make the copy of the array
}
}
ej
- Previous message: [javascript-dev] Re: [sharingisfun] js based change filter
- Next message: [javascript-dev] Re: [sharingisfun] js based change filter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
