plugin/com.blackberry.screenshot/src/blackberry10/index.js
function (success, fail, args, env) {
		var result = new PluginResult(args, env),
            userargs,
            wv,
            i;

		// userargs are encoded and need decoding & parsing into a json object
		userargs = JSON.parse(decodeURIComponent(args.userargs));
		// which window handle should we use?
		wv = qnx.webplatform.getWebViews();
		for (i = 0;i < wv.length;i++) {
			if (wv[i].zOrder === '0') {
				// found window handle.
				result.ok(screenshotJNEXT.getInstance().execute({
                    handle: wv[i].jsScreenWindowHandle,
                    userargs: userargs
				}));
				return;
			}
		}
		fail("error:no window handle");
	}
function (success, fail, args, env) {
		var result = new PluginResult(args, env),
            userargs,
            wv,
            i;

		// userargs are encoded and need decoding & parsing into a json object
		userargs = JSON.parse(decodeURIComponent(args.userargs));
		// which window handle should we use?
		wv = qnx.webplatform.getWebViews();
		for (i = 0;i < wv.length;i++) {
			if (wv[i].zOrder === '0') {
				// found window handle.
				result.ok(screenshotJNEXT.getInstance().execute({
                    handle: wv[i].jsScreenWindowHandle,
                    userargs: userargs
				}));
				return;
			}
		}
		fail("error:no window handle");
	}
execute() finds the window handle, processes userargs then performs the screenshot