Last active
May 21, 2020 18:52
-
-
Save nb1page/439165a909a5b6e5149425f9c3f65aa4 to your computer and use it in GitHub Desktop.
NB-Dispatch Simple Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Extension_test</title> | |
<script src="https://unpkg.com/@nucleome/nb-dispatch"></script> | |
</head> | |
<body> | |
<div id="connection"></div> | |
<button id="btn" >Navigate to chr2:10001-50000 </button> | |
<div id="message"></div> | |
<script> | |
(function() | |
{ | |
var chan = nb.dispatch("update","brush") | |
chan.connect(function(d){ | |
document.getElementById("connection").innerHTML = d.connection | |
}) | |
document.getElementById("btn").onclick = function(e){ | |
chan.call("update",this,[{chr:"chr2",start:10000,end:50000}]) | |
} | |
chan.on("update",function(d){ | |
document.getElementById("message").innerHTML = JSON.stringify(d) | |
}) | |
})() | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment