lib/SR_REST.js
function (name) {
			return function (args, onDone) {
				
				if (typeof args === 'function') {
					onDone = args;
					args = {};
				}
				
				console.log('calling API [' + name + ']...');
				
				// NOTE: by default callbacks are always kept
				SR.sendEvent(name, args, function (result) {
					if (result.err) {
						console.error(result.err);
						return SR.safeCall(onDone, result.err);
					}
					
					SR.safeCall(onDone, null, result.result);
				}, undefined, true);
			}
		}
function (name) {
			return function (args, onDone) {
				
				if (typeof args === 'function') {
					onDone = args;
					args = {};
				}
				
				console.log('calling API [' + name + ']...');
				
				// NOTE: by default callbacks are always kept
				SR.sendEvent(name, args, function (result) {
					if (result.err) {
						console.error(result.err);
						return SR.safeCall(onDone, result.err);
					}
					
					SR.safeCall(onDone, null, result.result);
				}, undefined, true);
			}
		}
function ( name ) { return function ( args , onDone ) { if ( typeof args === 'function' ) { onDone = args ; args = { } ; } console . log ( 'calling API [' + name + ']...' ) ; // NOTE: by default callbacks are always kept SR . sendEvent ( name , args , function ( result ) { if ( result . err ) { console . error ( result . err ) ; return SR . safeCall ( onDone , result . err ) ; } SR . safeCall ( onDone , null , result . result ) ; } , undefined , true ) ; } }
build a specific API
build a specific API