Classes


Last modified: 2013-2-27

Class JitterListener

Extends JitterObject.

JitterListener

Class Summary
Constructor Attributes Constructor Name and Description
 
JitterListener(object_name, callback)
JitterListener objects take two arguments: the object that they “listen” to, and the function that will be called when the object triggers an event.
Field Summary
Field Attributes Field Name and Description
Function 
The callback function to handle the event
JitterObject 
The object to listen to.
String 
Unknown
Fields borrowed from class Maxobj:
background, canhilite, colorindex, fontface, fontname, fontsize, hidden, hint, ignoreclick, js, maxclass, nextobject, patcher, rect, selected, valid, varname
Methods borrowed from class JitterObject:
freepeer, getregisteredname
Methods borrowed from class Maxobj:
annotation, color, help, message, notify, subpatcher, understands
Class Detail

JitterListener

(object_name, callback)
JitterListener objects take two arguments: the object that they “listen” to, and the function that will be called when the object triggers an event. Our JitterListener object is set to listen to our jit.window object (mywindow). The getregisteredname() property of a JitterObject object returns the name by which that object can be accessed by the JitterListener (in the case of jit.window objects, this will be the same as name of the drawing context). Whenever our jit.window object generates an event, a function called thecallback() will be triggered in our JavaScript code. Now that we’ve instantiated a JitterListener, we can (in most cases) leave it alone and simply deal with the mechanics of the callback function it triggers in response to an event from the object it listens to.

possible events depending on type of listened JitterObject
  • mouse
  • mouseidle
  • mouseidleout
  • mousewheel
  • matrix_received
  • message_received
  • connected_notification
  • import
  • collisions
  • matrixoutput
  • swap
Example:
//create jit.net.recv object
var recvr = new JitterObject("jit.net.recv");

//create listener and bind to recvr
var mylistener = new JitterListener(recvr.getregisteredname(),callbackfun);

function callbackfun(event){
	if (event.eventname == "matrix_received")
		matrixoutput(event.args[0]);
	else if (event.eventname == "message_received")
		messageoutput(event.args[0]);
	else if (event.eventname == "connected_notification")
		connectedoutput();
}
callbackfun.local = 1;
Parameters:
{String} object_name
{Function} callback
 
Field Detail
{Function}

function

The callback function to handle the event

{JitterObject}

object

The object to listen to.

{String}

subjectname

Unknown

©2012-2013
Max MSP Documentation copied to JsDoc by Tim Schenk SEO Frelancer Berlin. Some examples are by him. Some descriptions of classes, interfaces, properties, methods or events are by him. Until now, most of it is a copy. Published with permission of Cycling '74. This document might be wrong or incomplete. All informations without any warranty. All trademarks are the property of their respective owners. Documentation generated by JsDoc Toolkit on 2013-2-27