Add some interfaces in backend to send message and progress

pull/1405/head
LASER-Yi 4 years ago
parent 24cb712ad7
commit 8fcffaf339

@ -17,3 +17,15 @@ def event_stream(type, action="update", payload=None):
except (ValueError, TypeError):
pass
socketio.emit("data", {"type": type, "action": action, "payload": payload})
def show_message(msg):
event_stream(type="message", payload=msg)
def show_progress(name, percent):
event_stream(type="progress", payload={"name": name, "percent": percent})
def hide_progress(name):
event_stream(type="progress", action="delete", payload={"name": name, "percent": 0})

Loading…
Cancel
Save