如何在Bokeh上覆盖方法?如何检查所有元素是否已经在页面上呈现?

编程入门 行业动态 更新时间:2024-10-10 14:30:25
本文介绍了如何在Bokeh上覆盖方法?如何检查所有元素是否已经在页面上呈现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在将bokeh作为Bokeh服务器应用程序运行.

I am running bokeh as a Bokeh Server Application.

当所有项目都已经呈现在页面上时,我想执行一些操作.因此,我发现在此文件.消息后如何运行一些代码?我是否可以查看任何标志来检查服务器是否已加载以及是否渲染了所有元素?可以覆盖bokeh上的方法吗?

I would like to do some actions when all the items are already rendered on the page. So I found that a message is printed in this file. How could I run some code after the message? Is there any flag that I could see to check if the server is loaded and all the elements rendered? Is possible to override methods on bokeh?

if promise != null promise.then( (value) -> console.log("Bokeh items were rendered successfully") (error) -> console.log("Error rendering Bokeh items ", error) )

更新

由于仍然无法实现,因此我在此期间找到了一种解决方法:

As this is still not possible, I found a workaround in the mean time:

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

推荐答案

Bokeh目前没有为此内置任何功能.有一个开放功能可以添加对用户挂钩的支持,以在Bokeh文档init上运行代码:

Currently there is nothing built into Bokeh for this. There is an open feature to add support for a user-hook to run code on a Bokeh document init:

github/bokeh/bokeh/issues/4272

希望它将能够放入0.12.6.

我的猜测是,有一种 方法可以用于骇客的JS,也许其他人会在此同时找到解决方法.

My guess is that there is some way to do this with hacky JS, maybe someone else will have a workaround in the mean time.

更多推荐

如何在Bokeh上覆盖方法?如何检查所有元素是否已经在页面上呈现?

本文发布于:2023-11-27 14:39:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638488.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:元素   页面   方法   如何在   Bokeh

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!