server/www/login.js

24 lines
436 B
JavaScript
Raw Normal View History

2018-04-11 13:25:24 +02:00
function Login(domElem, lib) {
domElem.addEventListener('submit', function(e) {
e.preventDefault();
lib.send({tag: "LogIn", name: domElem.name.value})
});
domElem.leave.addEventListener('click', function(e) {
e.preventDefault();
lib.send({tag: "LogOut"})
});
return {
on: on,
off: off
};
2018-04-11 13:25:24 +02:00
function on(name) {
domElem.className = "on";
}
2018-04-11 13:25:24 +02:00
function off() {
domElem.className = "";
}
2018-04-11 13:25:24 +02:00
}