BB10/PreventSleep/ext/community.preventsleep/index.js
function (success, fail, args) {
		args = JSON.parse(decodeURIComponent(args["input"]));
		// look for the UIWebView in the set of WebViews.
		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 };
			success(preventsleep.getInstance().setPreventSleep(values));
		} else {
			success("Unable to get window handle");
		}
	}
function (success, fail, args) {
		args = JSON.parse(decodeURIComponent(args["input"]));
		// look for the UIWebView in the set of WebViews.
		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 };
			success(preventsleep.getInstance().setPreventSleep(values));
		} else {
			success("Unable to get window handle");
		}
	}
These methods call into preventsleepJNEXT.js which handles the communication through the JNEXT plugin to preventsleep_js.cpp