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

如何檢查我的 Bokeh Server 應用程序是否已完全加載

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

問題描述

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

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()
})

這里的問題是窗口永遠不會彈出,因為 electron 沒有檢測到服務器已加載.

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.

所以我不得不添加這個 setTimeout 作為解決方法.如果我不使用它,頁面將永遠卡住.

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

它檢查散景端口是否仍然關閉.但是元素可能沒有加載并完全加載

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

最后我找到了另一種解決方法來檢查是否所有元素都已完全呈現.答案在 這個問題:

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

有一個 GH 問題,作者要求在該問題時調用回調散景已完全加載和渲染.用戶 foobarbecue 建議驗證散景頁面是否使用 MutationObserver,但我沒用過.

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.

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

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

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創建子窗口時如何修復 BrowserWindow 不是構造函數錯誤) - IT屋-程序員軟件開發技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 成人免费av在线 | 一级a性色生活片久久毛片 午夜精品在线观看 | 荷兰欧美一级毛片 | 婷婷激情五月网 | 午夜电影福利 | 精品久久久网站 | 97国产在线视频 | 天天综合日日夜夜 | 久久中文免费视频 | 午夜精品 | 在线观看av网站 | 国产精品视频网 | 国产免费一区二区三区 | 狼人伊人影院 | 亚洲欧美一区二区三区国产精品 | 欧美三级电影在线播放 | 中文字幕日韩欧美一区二区三区 | 久久一日本道色综合久久 | 黄色三级在线播放 | 国产农村妇女精品一二区 | 美女久久久久 | 黄色毛片免费看 | 狠狠色狠狠色综合系列 | jizz在线免费观看 | 日韩一区二区三区在线播放 | 成人黄页在线观看 | 国产精品久久久久一区二区三区 | 色啪网 | 一级毛片免费 | 色综合久久天天综合网 | 午夜精品一区二区三区在线视频 | 国产成人一区在线 | 国产一区二区三区 | 99热精品在线 | 欧美午夜精品久久久久免费视 | 自拍偷拍亚洲一区 | 97视频人人澡人人爽 | 精品亚洲一区二区三区四区五区高 | av中文字幕在线观看 | 羞羞网站免费 | 成人亚洲性情网站www在线观看 |