summaryrefslogtreecommitdiff
path: root/handler.js
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-06-07 10:05:32 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-06-07 10:05:32 +0200
commitdd19910ec18ec60633bf5b4fcda5bab220d0565f (patch)
treec42c60a7daa15d99d772d670d53c29caf45d821b /handler.js
parent5f95718e7ebe4dec017055500793b928d8946d8e (diff)
Relocate all webservice files to src/ws and make sure they can be found by the service after install.
Diffstat (limited to 'handler.js')
-rw-r--r--handler.js101
1 files changed, 0 insertions, 101 deletions
diff --git a/handler.js b/handler.js
deleted file mode 100644
index 906a03b..0000000
--- a/handler.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set et sw=2 ts=2: */
-
-
-document.addEventListener("connectEvent", connectEventHandler, false);
-function connectEventHandler(e)
-{
- document.getElementById("wsnode_status").style.backgroundColor = "#40ff40";
- document.getElementById("wsnode_status").textContent = "NodeProto websocket connection opened ";
-
- //login("foobar", "hundemad");
- //subscribe(0);
-}
-
-document.addEventListener("disconnectEvent", disconnectEventHandler, false);
-function disconnectEventHandler(e)
-{
- document.getElementById("wsnode_status").style.backgroundColor = "#ff4040";
- document.getElementById("wsnode_status").textContent = "NodeProto websocket connection CLOSED ";
-}
-
-document.addEventListener("removeEvent", removeEventHandler, false);
-function removeEventHandler(e)
-{
- var subscribeid = e.detail.subscribeid;
- var id = e.detail.id;
-
- var node = findNode(id, subscribeid);
- if(node.parent) node.parent.removeChild(node);
-}
-
-document.addEventListener("moveEvent", moveEventHandler, false);
-function moveEventHandler(e)
-{
- var subscribeid = e.detail.subscribeid;
- var id = e.detail.id;
- var parentid = e.detail.parentid;
-
- var node = findNode(id, subscribeid);
- var new_parent = findNode(parentid, subscribeid);
- if(node != null && new_parent != null) new_parent.addChild(node);
-}
-
-document.addEventListener("createEvent", createEventHandler, false);
-function createEventHandler(e)
-{
- var subscribeid = e.detail.subscribeid;
- var id = e.detail.id;
- var parentid = e.detail.parentid;
-
- var node = new Node(id, subscribeid);
- node.create();
-
- if(parentid == -1) {
- nodes.push(node);
- var board = getBoard(subscribeid);
- board.appendChild(node.element);
- return;
- }
-
- var parent = findNode(parentid, subscribeid);
- if(parent != null) {
- parent.addChild(node);
- }
-
-}
-
-document.addEventListener("updateEvent", updateEventHandler, false);
-function updateEventHandler(e)
-{
- var subscribeid = e.detail.subscribeid;
- var id = e.detail.id;
- var name = e.detail.name;
- var value = e.detail.value;
-
- var node = findNode(id, subscribeid);
- if(node == null) return;
-
- node.setAttribute(name, value);
-}
-
-///////
-//////
-/////
-////
-///
-//
-
-document.addEventListener("messageEvent", messageEventHandler, false);
-function messageEventHandler(e) {
- LogEvent(e.detail.time.toString()+": "+e.detail.message
- );
-}
-
-// log event in console
-function LogEvent(msg) {
- var log = document.getElementById("log");
- log.textContent += msg + "\n";
- var ot = log.scrollHeight - log.clientHeight;
- if (ot > 0) log.scrollTop = ot;
-}