久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何檢查我的 Bokeh Server 應(yīng)用程序是否已完全加載

How to check if my Bokeh Server Application is completely loaded and rendered?(如何檢查我的 Bokeh Server 應(yīng)用程序是否已完全加載和渲染?)
本文介紹了如何檢查我的 Bokeh Server 應(yīng)用程序是否已完全加載和渲染?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我想將我的散景服務(wù)器應(yīng)用程序集成到 Electron 中.所以我所做的是像這樣使用 python-shell 運(yùn)行散景服務(wù)器

I would like to integrate my Bokeh Server Application in Electron. So what I did is to run bokeh server using python-shell like this

mainWindow = new BrowserWindow({
    width: 1000,
    height: 700,
    show: false,
})

var PythonShell = require('python-shell');
var options = {
    mode: 'text',
    pythonPath: 'python3',
    pythonOptions: ['-m'],
    scriptPath: '',
    args: ['serve','bokeh_project/']
};

PythonShell.run('bokeh', options, function (err, results) {
    if (err) throw err;
    console.log('results: %j', results);
});

mainWindow.loadURL('http://localhost:5006');

mainWindow.once('did-finish-load', () => {
    mainWindow.show()
})

這里的問(wèn)題是窗口永遠(yuǎn)不會(huì)彈出,因?yàn)?electron 沒(méi)有檢測(cè)到服務(wù)器已加載.

The problem here is that the window never pops up because electron does not detect the server as loaded.

推薦答案

我找到了一堆解決方法.我還在等待最終的解決方案.

I have found a bunch of workarounds. I am still waiting for the final solution.

所以我不得不添加這個(gè) setTimeout 作為解決方法.如果我不使用它,頁(yè)面將永遠(yuǎn)卡住.

So I had to add this setTimeout as a workaround. If I do not use this the page would be stuck forever.

setTimeout(function () {
    mainWindow.show();
    mainWindow.loadURL('http://localhost:5006');
}, 3000);

解決方法 2

它檢查散景端口是否仍然關(guān)閉.但是元素可能沒(méi)有加載并完全加載

Workaround 2

It checks if the bokeh port is still closed. But the elements may be not loaded and completely loaded

var portscanner = require('portscanner')
var _checkServerStatus = setInterval(function() {
  portscanner.checkPortStatus(5006, '127.0.0.1', function(error, status) {
    if (status == 'open') {  // status = 'open' or 'close'
        clearInterval(_checkServerStatus);
        console.log('Server running');
        mainWindow.loadURL(bokehUrl); 
    }
  });
}, 100);  

解決方法 3

最后我找到了另一種解決方法來(lái)檢查是否所有元素都已完全呈現(xiàn).答案在 這個(gè)問(wèn)題:

oldLog = console.log;
console.log = function (message) {
    if(message.localeCompare('Bokeh items were rendered successfully') == 0){
        window.top.postMessage('show-bokeh-iframe', '*')
        console.log = oldLog;
    }
    oldLog.apply(console, arguments);
};

解決方法 4

有一個(gè) GH 問(wèn)題,作者要求在該問(wèn)題時(shí)調(diào)用回調(diào)散景已完全加載和渲染.用戶 foobarbecue 建議驗(yàn)證散景頁(yè)面是否使用 MutationObserver,但我沒(méi)用過(guò).

Workaround 4

There is a GH issue where where the writer ask for calling a callback when bokeh is completely loaded and rendered. The user foobarbecue suggests to verify if the bokeh page is rendered with MutationObserver, but I have never used it.

這篇關(guān)于如何檢查我的 Bokeh Server 應(yīng)用程序是否已完全加載和渲染?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進(jìn)程中創(chuàng)建子窗口時(shí)如何修復(fù) BrowserWindow 不是構(gòu)造函數(shù)錯(cuò)誤) - IT屋-程序員軟件開(kāi)發(fā)技術(shù)
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應(yīng)用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無(wú)法在第二個(gè) loadURL 上執(zhí)行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內(nèi)使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲(chǔ)?)
How to access camera/webcamera inside electron app?(如何在電子應(yīng)用程序中訪問(wèn)相機(jī)/網(wǎng)絡(luò)攝像頭?)
主站蜘蛛池模板: 亚洲风情在线观看 | 精品日韩一区二区 | 欧美精品久久久 | 欧美在线一区二区三区 | 久久黄网| 精品国产乱码久久久久久闺蜜 | 伊人网站在线 | 色综合桃花网 | 久久精品视频网站 | 久久首页 | 蜜桃一区 | 在线亚洲一区 | 中文字幕成人av | 国产精品有限公司 | 免费在线观看一区二区 | 亚洲一区精品在线 | 亚洲欧美综合 | 国产日韩欧美电影 | 国产乱码精品一区二区三区五月婷 | 中文字幕99 | 亚洲成人一区二区 | 亚洲国产精品自拍 | 久久亚洲欧美日韩精品专区 | 欧美日韩中文字幕 | 国产精品成人一区二区 | 99re在线视频 | 国产视频二区 | 日韩欧美在线视频 | 九九视频在线观看 | 少妇精品亚洲一区二区成人 | 久久精品在线 | 国产欧美视频一区二区三区 | 日韩高清国产一区在线 | 欧美一区二区三区免费电影 | 在线成人一区 | 女女爱爱视频 | 色综合久久天天综合网 | 亚洲欧美中文字幕 | 久久大陆 | 一区二区中文字幕 | 男女视频在线免费观看 |