В электронном 4.0.1 как скрыть строку меню под linux

Ну, это просто 4-х шаговый простой процесс,

Надеюсь, он поможет

Step 1. Хранить ссылку на объект XMLHttpRequest

var xmlHttp = createXmlHttpRequestObject();

Step 2. Получить объект XMLHttpRequest

function createXmlHttpRequestObject() {
    // will store the reference to the XMLHttpRequest object
    var xmlHttp;
    // if running Internet Explorer
    if (window.ActiveXObject) {
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
            xmlHttp = false;
        }
    }
    // if running Mozilla or other browsers
    else {
        try {
            xmlHttp = new XMLHttpRequest();
        } catch (e) {
            xmlHttp = false;
        }
    }
    // return the created object or display an error message
    if (!xmlHttp)
        alert("Error creating the XMLHttpRequest object.");
    else
        return xmlHttp;
}

Step 3. Сделать асинхронный HTTP-запрос с использованием объекта XMLHttpRequest

function process() {
    // proceed only if the xmlHttp object isn't busy
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
        // retrieve the name typed by the user on the form
        item = encodeURIComponent(document.getElementById("input_item").value);
        // execute the your_file.php page from the server
        xmlHttp.open("GET", "your_file.php?item=" + item, true);
        // define the method to handle server responses
        xmlHttp.onreadystatechange = handleServerResponse;
        // make the server request
        xmlHttp.send(null);
    }
}

Step 4. Выполнено автоматически, когда сообщение получено с сервера

function handleServerResponse() {

    // move forward only if the transaction has completed
    if (xmlHttp.readyState == 4) {
        // status of 200 indicates the transaction completed successfully
        if (xmlHttp.status == 200) {
            // extract the XML retrieved from the server
            xmlResponse = xmlHttp.responseText;
            document.getElementById("put_response").innerHTML = xmlResponse;
            // restart sequence
        }
        // a HTTP status different than 200 signals an error
        else {
            alert("There was a problem accessing the server: " + xmlHttp.statusText);
        }
    }
}
1
задан Arnold Rimmer 15 January 2019 в 19:29
поделиться

1 ответ

Это должно работать так же, но похоже, что в Electron есть ошибка ( https://github.com/electron/electron/issues/15901 ). В комментариях предлагается обходной путь: установите autoHideMenuBar -option в true при создании объекта BrowserWindow. К сожалению, это все еще покажет меню, когда нажата клавиша alt.

Кроме того, вы можете попробовать Электрон версии 3.

0
ответ дан Pretseli 15 January 2019 в 19:29
поделиться
Другие вопросы по тегам:

Похожие вопросы: