mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
log errors from event listeners
This commit is contained in:
parent
4fbdab976e
commit
0218c7f8ef
6 changed files with 35 additions and 7 deletions
|
|
@ -5,6 +5,10 @@ const ChromecastTransport = require('./ChromecastTransport');
|
|||
|
||||
let castAPIAvailable = null;
|
||||
const castAPIEvents = new EventEmitter();
|
||||
castAPIEvents.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
window['__onGCastApiAvailable'] = function(available) {
|
||||
delete window['__onGCastApiAvailable'];
|
||||
castAPIAvailable = available;
|
||||
|
|
@ -18,7 +22,10 @@ function Chromecast() {
|
|||
let transport = null;
|
||||
|
||||
const events = new EventEmitter();
|
||||
events.on('error', () => { });
|
||||
events.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
function onCastAPIAvailabilityChanged() {
|
||||
if (castAPIAvailable) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ const MESSAGE_NAMESPACE = 'urn:x-cast:com.stremio';
|
|||
|
||||
function ChromecastTransport() {
|
||||
const events = new EventEmitter();
|
||||
events.on('error', () => { });
|
||||
events.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cast.framework.CastContext.getInstance().addEventListener(
|
||||
cast.framework.CastContextEventType.CAST_STATE_CHANGED,
|
||||
|
|
|
|||
|
|
@ -6,12 +6,18 @@ const CoreTransport = require('./CoreTransport');
|
|||
|
||||
let coreAPIAvailable = null;
|
||||
const coreAPIEvents = new EventEmitter();
|
||||
coreAPIEvents.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
initializeCoreAPI()
|
||||
.then(() => {
|
||||
coreAPIAvailable = true;
|
||||
coreAPIEvents.emit('availabilityChanged');
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
coreAPIAvailable = false;
|
||||
coreAPIEvents.emit('availabilityChanged');
|
||||
});
|
||||
|
|
@ -23,7 +29,10 @@ function Core() {
|
|||
let transport = null;
|
||||
|
||||
const events = new EventEmitter();
|
||||
events.on('error', () => { });
|
||||
events.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
function onCoreAPIAvailabilityChanged() {
|
||||
if (coreAPIAvailable) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ const { StremioCoreWeb } = require('@stremio/stremio-core-web');
|
|||
|
||||
function CoreTransport() {
|
||||
const events = new EventEmitter();
|
||||
events.on('error', () => { });
|
||||
events.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
const core = new StremioCoreWeb(({ name, args }) => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ function KeyboardShortcuts() {
|
|||
let active = false;
|
||||
|
||||
const events = new EventEmitter();
|
||||
events.on('error', () => { });
|
||||
events.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
function onKeyDown(event) {
|
||||
if (event.keyboardShortcutPrevented || event.target.tagName === 'INPUT') {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ function Shell() {
|
|||
let starting = false;
|
||||
|
||||
const events = new EventEmitter();
|
||||
events.on('error', () => { });
|
||||
events.on('error', (error) => {
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
function onStateChanged() {
|
||||
events.emit('stateChanged');
|
||||
|
|
|
|||
Loading…
Reference in a new issue