examples/template_stealjs/steal/steal.js
function convert(ob, func){
			
		var oldFunc = ob[func];
		
		// if we don't have callbacks
		if(!ob[func].callbacks){
			//replace start with a function that will call ob2's method
			ob[func] = function(){
				var me = arguments.callee,
					ret;
				
				// call the original function
				ret = oldFunc.apply(ob,arguments);
				
				var cbs = me.callbacks,
					len = cbs.length;
				
				//mark as called so any callees added to this caller will
				//automatically get called
				me.called = true;
				// call other callbacks
				for(var i =0; i < len; i++){
					cbs[i].called()
				}
				return ret;
				
			}
			ob[func].callbacks = [];
		}

		return ob[func];
	}
function convert(ob, func){
			
		var oldFunc = ob[func];
		
		// if we don't have callbacks
		if(!ob[func].callbacks){
			//replace start with a function that will call ob2's method
			ob[func] = function(){
				var me = arguments.callee,
					ret;
				
				// call the original function
				ret = oldFunc.apply(ob,arguments);
				
				var cbs = me.callbacks,
					len = cbs.length;
				
				//mark as called so any callees added to this caller will
				//automatically get called
				me.called = true;
				// call other callbacks
				for(var i =0; i < len; i++){
					cbs[i].called()
				}
				return ret;
				
			}
			ob[func].callbacks = [];
		}

		return ob[func];
	}
function convert ( ob , func ) { var oldFunc = ob [ func ] ; // if we don't have callbacks if ( ! ob [ func ] . callbacks ) { //replace start with a function that will call ob2's method ob [ func ] = function ( ) { var me = arguments . callee , ret ; // call the original function ret = oldFunc . apply ( ob , arguments ) ; var cbs = me . callbacks , len = cbs . length ; //mark as called so any callees added to this caller will //automatically get called me . called = true ; // call other callbacks for ( var i = 0 ; i < len ; i ++ ) { cbs [ i ] . called ( ) } return ret ; } ob [ func ] . callbacks = [ ] ; } return ob [ func ] ; }
converts a function to work with when
converts a function to work with when