function (success, fail, args, env) {
		var result = new PluginResult(args, env);
		args = JSON.parse(decodeURIComponent(args["input"]));
		var views = qnx.webplatform.getWebViews();
		var handle = null;
		var z = -1;
		for (var i = 0; i < views.length; i++) {
			if (views[i].visible && views[i].zOrder > z){
				z = views[i].zOrder;
				handle = views[i].jsScreenWindowHandle;
			}
		}
		if (handle !== null) {
			var values = { value: args, handle: handle };
			result.ok(preventSleep.getInstance().setPreventSleep(result.callbackId, values), false);
		} else {
			result.error("Unable to get window handle", false);
		}
	}
function (success, fail, args, env) {
		var result = new PluginResult(args, env);
		args = JSON.parse(decodeURIComponent(args["input"]));
		var views = qnx.webplatform.getWebViews();
		var handle = null;
		var z = -1;
		for (var i = 0; i < views.length; i++) {
			if (views[i].visible && views[i].zOrder > z){
				z = views[i].zOrder;
				handle = views[i].jsScreenWindowHandle;
			}
		}
		if (handle !== null) {
			var values = { value: args, handle: handle };
			result.ok(preventSleep.getInstance().setPreventSleep(result.callbackId, values), false);
		} else {
			result.error("Unable to get window handle", false);
		}
	}
function ( success , fail , args , env ) { var result = new PluginResult ( args , env ) ; args = JSON . parse ( decodeURIComponent ( args [ "input" ] ) ) ; var views = qnx . webplatform . getWebViews ( ) ; var handle = null ; var z = - 1 ; for ( var i = 0 ; i < views . length ; i ++ ) { if ( views [ i ] . visible && views [ i ] . zOrder > z ) { z = views [ i ] . zOrder ; handle = views [ i ] . jsScreenWindowHandle ; } } if ( handle !== null ) { var values = { value : args , handle : handle } ; result . ok ( preventSleep . getInstance ( ) . setPreventSleep ( result . callbackId , values ) , false ) ; } else { result . error ( "Unable to get window handle" , false ) ; } }
Code can be declared and used outside the module.exports object, but any functions to be called by client.js need to be declared here in this object.
Code can be declared and used outside the module . exports object but any functions to be called by client . js need to be declared here in this object .