From cf2f763d1bd23170cb82e0df9eff363931cc66dc Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Sat, 20 Jun 2020 11:29:06 +0300 Subject: user macro --- web/share/js/kvm/mouse.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'web/share/js/kvm/mouse.js') diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index dca2f4c5..9ac1fd0c 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -27,11 +27,13 @@ import {tools, $} from "../tools.js"; import {Keypad} from "../keypad.js"; -export function Mouse() { +export function Mouse(record_callback) { var self = this; /************************************************************************/ + var __record_callback = record_callback; + var __ws = null; var __online = true; @@ -194,9 +196,11 @@ export function Mouse() { }; var __sendEvent = function(event_type, event) { + event = {"event_type": event_type, "event": event}; if (__ws) { - __ws.send(JSON.stringify({"event_type": event_type, "event": event})); + __ws.send(JSON.stringify(event)); } + __record_callback(event); }; __init__(); -- cgit v1.2.3