src/js/utils.js
branchpopcorn-port
changeset 73 a8192c57c87d
parent 60 ffc038fdb8f1
child 78 d77fe3283530
equal deleted inserted replaced
72:c4a36ea700d4 73:a8192c57c87d
     2 
     2 
     3 /* trace function, for debugging */
     3 /* trace function, for debugging */
     4 
     4 
     5 IriSP.traceNum = 0;
     5 IriSP.traceNum = 0;
     6 IriSP.trace = function( msg, value ) {
     6 IriSP.trace = function( msg, value ) {
     7 
     7 /*
     8 	if( IriSP.config.gui.debug === true ) {
     8 	if( IriSP.config.gui.debug === true ) {
     9 		IriSP.traceNum += 1;
     9 		IriSP.traceNum += 1;
    10 		IriSP.jQuery( "<div>"+IriSP.traceNum+" - "+msg+" : "+value+"</div>" ).appendTo( "#Ldt-output" );
    10 		IriSP.jQuery( "<div>"+IriSP.traceNum+" - "+msg+" : "+value+"</div>" ).appendTo( "#Ldt-output" );
    11 	}
    11 	}
       
    12 */
    12 };
    13 };
       
    14 
       
    15 /* used in callbacks - because in callbacks we lose "this",
       
    16    we need to have a special function which wraps "this" in 
       
    17    a closure. This way, the 
       
    18 */   
       
    19 IriSP.wrap = function (obj, fn) {
       
    20   return function() {
       
    21     args = [].slice.call(this, arguments);
       
    22     fn.call(obj, args);
       
    23   }
       
    24 }
    13 
    25 
    14 /* for ie compatibility
    26 /* for ie compatibility
    15 if (Object.prototype.__defineGetter__&&!Object.defineProperty) {
    27 if (Object.prototype.__defineGetter__&&!Object.defineProperty) {
    16    Object.defineProperty=function(obj,prop,desc) {
    28    Object.defineProperty=function(obj,prop,desc) {
    17       if ("get" in desc) obj.__defineGetter__(prop,desc.get);
    29       if ("get" in desc) obj.__defineGetter__(prop,desc.get);