fix: popup UI.rfb not found

This commit is contained in:
Doro Wu 2018-03-28 00:13:21 +08:00
parent 12b6fe995c
commit 761933bd7f
1 changed files with 18 additions and 11 deletions

View File

@ -333,17 +333,24 @@
<source src="novnc/app/sounds/bell.mp3" type="audio/mpeg"> <source src="novnc/app/sounds/bell.mp3" type="audio/mpeg">
</audio> </audio>
<script type="module"> <script type="module">
import UI from './novnc/app/ui.js'; import UI from './novnc/app/ui.js';
UI.rfb.addEventListener('connect', function(event) { var f = function () {
window.parent.postMessage(JSON.stringify({from: 'novnc', state: 'connected'}), '*'); if (!UI.rfb) {
UI.rfb._display.defaultCursor(); setTimeout(f, 1000);
// console.log(UI.connected) } else {
// console.log(event); UI.rfb.addEventListener('connect', function(event) {
}); window.parent.postMessage(JSON.stringify({from: 'novnc', state: 'connectedd'}), '*');
UI.rfb.addEventListener('disconnect', function(event) { UI.rfb._display.defaultCursor();
window.parent.postMessage(JSON.stringify({from: 'novnc', state: 'disconnected'}), '*'); // console.log(UI.connected)
}); // console.log(event);
// console.log(UI.rfb._rfb_connection_state); });
UI.rfb.addEventListener('disconnect', function(event) {
window.parent.postMessage(JSON.stringify({from: 'novnc', state: 'disconneccted'}), '*');
});
// console.log(UI.rfb._rfb_connection_state);
}
};
f();
</script> </script>
</body> </body>
</html> </html>