* fixing alert registration bug

This commit is contained in:
Seth Call 2014-06-12 14:52:26 -05:00
parent 8c92820275
commit b93ff48a91
4 changed files with 19 additions and 23 deletions

View File

@ -70,7 +70,7 @@
var alertData = ALERT_TYPES[type];
if(alertData) {
$document.triggerHandler('alert.' + alertData.name, alertData);
$document.triggerHandler(alertData.name, alertData);
}
if (type === 2) { // BACKEND_MIXER_CHANGE

View File

@ -449,12 +449,14 @@
context.JK.onBackendEvent = function(type, namespace, callback) {
var alertData = ALERT_TYPES[type];
if(!alertData) {throw "onBackendEvent: unknown alert type " + type};
logger.debug("onBackendEvent: " + alertData.name + '.' + namespace)
$(document).on(alertData.name + '.' + namespace, callback);
}
context.JK.offBackendEvent = function(type, namespace, callback) {
var alertData = ALERT_TYPES[type].name;
var alertData = ALERT_TYPES[type];
if(!alertData) {throw "offBackendEvent: unknown alert type " + type};
logger.debug("offBackendEvent: " + alertData.name + '.' + namespace, alertData)
$(document).off(alertData.name + '.' + namespace);
}
/*

View File

@ -37,30 +37,23 @@
}
function onInvalidAudioDevice(e, data) {
var maxAlertTime = 5000;
if(new Date().getTime() - lastSavedTime.getTime() < maxAlertTime) {
$selectedChatInput = null;
// you can't do this in the event callback; it hangs the app indefinitely, and somehow 'sticks' the mic input into bad state until reboot
setTimeout(function() {
context.jamClient.FTUEClearChatInput();
context.jamClient.TrackSetChatEnable(true);
var result = context.jamClient.TrackSaveAssignments();
if(!result || result.length == 0) {
context.JK.Banner.showAlert('It appears the selected chat input is not functioning. Please try another chat input.');
}
else {
context.JK.alertSupportedNeeded("Unable to unwind invalid chat input selection.")
}
}, 1);
}
else {
logger.debug("voiceChatHelper: invalid device event occurred, but not within " + maxAlertTime);
}
logger.debug("voice_chat_helper: onInvalidAudioDevice")
$selectedChatInput = null;
// you can't do this in the event callback; it hangs the app indefinitely, and somehow 'sticks' the mic input into bad state until reboot
setTimeout(function() {
context.jamClient.FTUEClearChatInput();
context.jamClient.TrackSetChatEnable(true);
var result = context.jamClient.TrackSaveAssignments();
if(!result || result.length == 0) {
context.JK.Banner.showAlert('It appears the selected chat input is not functioning. Please try another chat input.');
}
else {
context.JK.alertSupportedNeeded("Unable to unwind invalid chat input selection.")
}
}, 1);
}
function beforeShow() {
context.JK.onBackendEvent(ALERT_NAMES.AUDIO_DEVICE_NOT_PRESENT, 'voice_chat_helper', onInvalidAudioDevice);
}
function beforeHide() {

View File

@ -290,6 +290,7 @@
}
function onInvalidAudioDevice() {
logger.debug("gear_test: onInvalidAudioDevice")
asynchronousInvalidDevice = true;
$self.triggerHandler(GEAR_TEST_INVALIDATED_ASYNC);
context.JK.Banner.showAlert('Invalid Audio Device', 'It appears this audio device is not currently connected. Attach the device to your computer and restart the application, or select a different device.')