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"})
|
|
|
|
});
|
|
|
|
|
2018-04-12 23:01:40 +02:00
|
|
|
return {
|
|
|
|
on: on,
|
|
|
|
off: off
|
|
|
|
};
|
2018-04-11 13:25:24 +02:00
|
|
|
|
2018-04-12 23:01:40 +02:00
|
|
|
function on(name) {
|
|
|
|
domElem.className = "on";
|
|
|
|
}
|
2018-04-11 13:25:24 +02:00
|
|
|
|
2018-04-12 23:01:40 +02:00
|
|
|
function off() {
|
|
|
|
domElem.className = "";
|
|
|
|
}
|
2018-04-11 13:25:24 +02:00
|
|
|
}
|