Now with Quitting apps, and defaults to currently running app. This closes #18

This commit is contained in:
R. Aidan Campbell 2016-03-11 11:04:53 -05:00
parent 6e26a24939
commit 8bb359714d

View File

@ -15,7 +15,7 @@ function attachListeners() {
$('#bitrateSlider').on('input', updateBitrateField); // input occurs every notch you slide
$('#bitrateSlider').on('change', saveBitrate); // change occurs once the mouse lets go.
$('#startGameButton').on('click', startSelectedGame);
$('#quitGameButton').on('click', stopGame);
$(window).resize(fullscreenNaclModule);
}
@ -118,6 +118,7 @@ function showAppsPushed() {
opt.innerHTML = appList[i].title;
$('#selectGame')[0].appendChild(opt);
}
if (api.currentGame != 0) $('#selectGame')[0].value = api.currentGame;
});
} else {
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
@ -131,6 +132,7 @@ function showAppsPushed() {
opt.innerHTML = appList[i].title;
$('#selectGame')[0].appendChild(opt);
}
if (api.currentGame != 0) $('#selectGame')[0].value = api.currentGame;
});
});
});
@ -259,10 +261,22 @@ function fullscreenNaclModule() {
// user pushed the stop button. we should stop.
function stopPushed() {
//common.naclModule.postMessage('stopRequested');
sendMessage('stopRequested');
}
function stopGame() {
if (api && api.paired) {
return api.quitApp();
} else {
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
api = new NvHTTP(target, myUniqueid);
api.init().then(function (ret) {
return api.quitApp();
});
});
}
}
function storeData(key, data, callbackFunction) {
var obj = {};
obj[key] = data;