当前位置: 首页 > 知识库问答 >
问题:

如果指定了目标或源,如何拒绝连接(分离)?

东门玺
2023-03-14

我是jsPlumb的新手,我对演示很感兴趣。当指定目标或源时,我不需要允许连接。我的意思是:当目标是X-连接无法建立。

共有1个答案

景品
2023-03-14

当建立连接时,jsPlumb触发一个事件connection

jsPlumb.bind("connection", function(info) {
    if(info.sourceId==='abc'){
      jsPlumb.detach(info.connection);
    }

});

信息是具有以下属性的对象:

connection - the new Connection. you can register listeners on this etc.
sourceId - id of the source element in the Connection
targetId - id of the target element in the Connection
source - the source element in the Connection
target - the target element in the Connection
sourceEndpoint - the source Endpoint in the Connection
targetEndpoint - the targetEndpoint in the Connection

参考资料:

http://www.jsplumb.org/doc/events.html#evt-connection-detachedhttp://www.jsplumb.org/doc/removing.htmlhttp://www.jsplumb.org/apidocs/classes/jsPlumb.html#method_detach

 类似资料:
  • 我有一个简单的Spring Boot应用程序,它公开了一个RESTAPI。我已经使用@PreAuthorize(“hasRole('ROLE_4'))注释成功地配置了Spring Security性,以根据restapi中的角色保护每个方法。 我注意到,如果我根本不把@PreAuthorize注释,框架允许任何经过身份验证的用户进行此请求。我想扭转这种行为。因此,如果其中一个程序员忘记添加@Pre

  • 我尝试使用Virtualbox在MacOS上运行minikube v0.22.1和kubectl v1.7.5。 但是,所有命令都失败并显示“连接被拒绝-您指定了正确的主机或端口吗?” 此处提出的解决方案(< code > sudo ifconfig vboxnet0 up )没有帮助,vbox net 0接口已启动。 我们非常感谢您的任何想法或建议。

  • 我使用的是Postgres 9.1.5。JDBC在第一个实例中运行良好,但当我再次尝试时,它开始拒绝连接。例如,我使用JDBC登录到我的web应用程序,效果很好。但是,我尝试使用连接获取其他数据,它引发了一个异常:连接被拒绝。我确信我的代码没有问题,因为上次运行良好的登录JDBC也引发了一个异常:连接被拒绝。 重新启动postgres windows服务后,它再次工作。然后,登录JDBC,获取一些

  • 我试图实现一个TCP连接,在服务器端一切正常,但当我运行客户端程序(从客户端计算机)时,我得到以下错误: 服务器代码: 客户端代码: