JSFiddle - React, Tailwind, and code Playground
JavaScript
Main = {
disabledKeys:['SOURCE', 'MUTE'],
init:function () {
this.widgetAPI = new Common.API.Widget();
this.tvKey = new Common.API.TVKeyValue();
this.pluginAPI = new Common.API.Plugin();
$(document).keydown(function () {
for (var i = 0; i < Main.disabledKeys.length; i++) {
if (event.keyCode == Main.tvKey['KEY_' + Main.disabledKeys[i].toUpperCase()]) {
Main.widgetAPI.blockNavigation(event);
}
}
;
});
this.widgetAPI.sendReadyEvent();
},
disableKey:function (key) {
try {
this.pluginAPI.registKey(this.tvKey['KEY_' + key.toUpperCase()]);
} catch (e) {
Main.logException(e);
}
},
onShowEventHandler:function () {
for (var i = 0; i < this.disabledKeys.length; i++) {
this.disableKey(Main.disabledKeys[i]);
}
}
};
window.onshow = Main.onShowEventHandler;