Add state json for javascript
This commit is contained in:
parent
dc10240c2d
commit
522879216a
|
@ -68,7 +68,7 @@ class WebDialingState(DialingState):
|
|||
|
||||
def on_nummernschalter_input(self, num):
|
||||
super().on_nummernschalter_input(num)
|
||||
#self.web.send_event({"event": "num_entered", "data": {"number": int(num)}})
|
||||
self.web.send_event({"event": "num_entered", "data": {"number": int(num)}})
|
||||
|
||||
|
||||
class FeTapWeb():
|
||||
|
@ -86,10 +86,13 @@ class FeTapWeb():
|
|||
return "<h1>Hello world!</h1>"
|
||||
|
||||
def publish_status(self):
|
||||
new_state = eval("Web" + self.controller.state.__class__.__name__)(self)
|
||||
state_name = self.controller.state.__class__.__name__
|
||||
new_state = eval("Web" + state_name)(self)
|
||||
self.controller.state = new_state
|
||||
data = {"state": state_name}
|
||||
data = json.dumps(data)
|
||||
for ws in self.websockets:
|
||||
ws.send("this is a message triggered from the server")
|
||||
ws.send(data)
|
||||
|
||||
def send_event(self, js_event):
|
||||
data = json.dumps(js_event)
|
||||
|
|
Loading…
Reference in a new issue