diff -r 2bdf5d51d434 -r a7b0e40bcab0 front_idill/extern/fajran-tuiojs/src/tuio.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/front_idill/extern/fajran-tuiojs/src/tuio.js Fri Apr 06 18:32:13 2012 +0200 @@ -0,0 +1,148 @@ + +(function() { + var TUIO = function() { + // Listener class + + this.Listener = function(impl) { + if (impl != undefined) { + // override original method implementation + for (var key in impl) { + this[key] = impl[key]; + } + } + } + this.Listener.prototype = { + object_add: function(data) { }, + object_update: function(data) { }, + object_remove: function(data) { }, + cursor_add: function(data) { }, + cursor_update: function(data) { }, + cursor_remove: function(data) { } + } + + // Instance variables + + this.objects = []; + this.cursors = []; + + this._data = {}; + + this._default_listener = new this.Listener(); + this._listeners = [this._default_listener]; + + this._connector = undefined; + + }; + TUIO.prototype = { + start: function(name) { + var c = this._connector; + if (c != undefined) { + if (c.start != undefined) { + c.start(); + } + } + }, + + stop: function() { + var c = this._connector; + if (c != undefined) { + if (c.stop != undefined) { + c.stop(); + } + } + }, + + setConnector: function(connector) { + this._connector = connector; + }, + + addListener: function(listener) { + this._listeners.push(listener); + }, + removeListener: function(listener) { + this._listeners.splice(this._listeners.indexOf(listener), 1); + }, + + _invoke: function(method, data) { + var i, len = this._listeners.length; + for (i=0; i