diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-10-27 13:22:36 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-11-09 13:14:16 +0100 |
commit | e89eef94aaec7e64d279f76bcb1fbca75ce26358 (patch) | |
tree | da2ab245b187f6dd58ffa2b21929b18cd944c01c /vnc_lite.html | |
parent | 65fdfeae13c773683020d3152231e9074d35cd40 (diff) | |
download | novnc-e89eef94aaec7e64d279f76bcb1fbca75ce26358.tar.gz |
Use standard EventTarget interface for events
Diffstat (limited to 'vnc_lite.html')
-rw-r--r-- | vnc_lite.html | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/vnc_lite.html b/vnc_lite.html index 1a952f1..6575b46 100644 --- a/vnc_lite.html +++ b/vnc_lite.html @@ -98,10 +98,10 @@ UIresize(); doneInitialResize = true; } - function updateDesktopName(rfb, name) { - desktopName = name; + function updateDesktopName(e) { + desktopName = e.detail.name; } - function credentials(rfb, types) { + function credentials(e) { var html; var form = document.createElement('form'); @@ -148,9 +148,9 @@ document.getElementById('noVNC_status_bar').setAttribute("class", "noVNC_status_" + level); document.getElementById('noVNC_status').textContent = text; } - function updateState(rfb, state, oldstate) { + function updateState(e) { var cad = document.getElementById('sendCtrlAltDelButton'); - switch (state) { + switch (e.detail.state) { case 'connecting': status("Connecting", "normal"); break; @@ -172,11 +172,11 @@ status("Disconnected", "normal"); break; default: - status(state, "warn"); + status(e.detail.state, "warn"); break; } - if (state === 'connected') { + if (e.detail.state === 'connected') { cad.disabled = false; } else { cad.disabled = true; @@ -184,13 +184,13 @@ } } - function disconnected(rfb, reason) { - if (typeof(reason) !== 'undefined') { - status(reason, "error"); + function disconnect(e) { + if (typeof(e.detail.reason) !== 'undefined') { + status(e.detail.reason, "error"); } } - function notification(rfb, msg, level) { - status(msg, level); + function notification(e) { + status(e.detail.message, e.detail.level); } window.onresize = function () { @@ -275,12 +275,12 @@ shared: WebUtil.getConfigVar('shared', true), credentials: { password: password } }); rfb.viewOnly = WebUtil.getConfigVar('view_only', false); - rfb.onnotification = notification; - rfb.onupdatestate = updateState; - rfb.ondisconnected = disconnected; - rfb.oncapabilities = function () { updatePowerButtons(); initialResize(); }; - rfb.oncredentialsrequired = credentials; - rfb.ondesktopname = updateDesktopName; + rfb.addEventListener("notification", notification); + rfb.addEventListener("updatestate", updateState); + rfb.addEventListener("disconnect", disconnect); + rfb.addEventListener("capabilities", function () { updatePowerButtons(); initialResize(); }); + rfb.addEventListener("credentialsrequired", credentials); + rfb.addEventListener("desktopname", updateDesktopName); })(); </script> </head> |