const { ipcRenderer } = require('electron');
ipcRenderer.on('runGame', (event, data) => {
    if(data.indexOf('https://') == -1){
        data = data.replace('https//', 'https://');
    }
    console.log('Data: ', data);
    let baseUrl = data.substr(0, data.lastIndexOf('/')) + '/',
        baseAttribute = '';
        if(typeof data != 'undefined' && data.indexOf('multi_file=') != -1){
            baseAttribute =  ' base="'+ baseUrl +'"';
        };
        document.getElementById('embed_code').innerHTML = '<embed width="100%"'+ baseAttribute +' height="100%" src="'+ data +'"></embed>';
        /*ipcRenderer.removeAllListeners('runGame');*/
});