messages now a bit different, less contructions

not constructing one for each possible message but only constructing when message happens
This commit is contained in:
2020-02-16 23:17:46 +01:00
parent 23c1ec33a1
commit e3792005ba
7 changed files with 52 additions and 51 deletions
+7 -6
View File
@@ -38,12 +38,13 @@ class Message:
self._args = []
def msg(message, params):
if not issubclass(type(message), Message):
window.console.log("Not scheduling a Message type, this will not work!")
return lambda: None
def msg(message_class, params):
def callback(event):
message.on_event(event) #message_class(event, params)
message = message_class(params)
if not issubclass(type(message), Message):
window.console.log("Not scheduling a Message type, this will not work!")
return
message.on_event(event)
update.schedule(message)
return callback