lib/paworker.js
function onExec(funcStr, parStr, context) {
	var	func,
		par, 
		data,
		err = null;
	try {	
		// Check task
		if(!funcStr || !context) {
			throw Error('Worker received invalid task');
		}

		par = parStr ? JSON.parse(parStr) : null;

		// parse the serialized function
		// eval() may be evil but here we don't have much choice
		eval('var func = ' + funcStr);
		data = func(par);
//		console.log(' - '+data);
	} catch(e) {
		data = null;
		err = e;
	}
	
	process.send({
		result: data,
		err: err,
		context: context
	});
}
function onExec(funcStr, parStr, context) {
	var	func,
		par, 
		data,
		err = null;
	try {	
		// Check task
		if(!funcStr || !context) {
			throw Error('Worker received invalid task');
		}

		par = parStr ? JSON.parse(parStr) : null;

		// parse the serialized function
		// eval() may be evil but here we don't have much choice
		eval('var func = ' + funcStr);
		data = func(par);
//		console.log(' - '+data);
	} catch(e) {
		data = null;
		err = e;
	}
	
	process.send({
		result: data,
		err: err,
		context: context
	});
}
function onExec ( funcStr , parStr , context ) { var func , par , data , err = null ; try { // Check task if ( ! funcStr || ! context ) { throw Error ( 'Worker received invalid task' ) ; } par = parStr ? JSON . parse ( parStr ) : null ; // parse the serialized function // eval() may be evil but here we don't have much choice eval ( 'var func = ' + funcStr ) ; data = func ( par ) ; //		console.log(' - '+data); } catch ( e ) { data = null ; err = e ; } process . send ( { result : data , err : err , context : context } ) ; }
Handle exec requests
Handle exec requests