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

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