Closed Jaymon closed 5 years ago
Another idea would be to just make all events atomic unless you specify differently, I think that might be the better approach
Some notes on the new event handling system I had in the code:
e = Event()
e[0] # args[0]
e["html"] # kwargs["html"]
e.html # kwargs["html"]
e.event_name # the event name
e.config # the configuration
# a callback signature would look like:
# callback(event, config, html)
# and event.html would point to the past, bah, that won't work, so
# maybe:
#
# callback(event, config) and config would point to event.config but
# everything else will be in event, so you could access html by
# event.html
# let's make it so .broadcast takes (event_name, config, **kwargs) and
# those kwargs will be available through the event instance passed into
# the callback
Right now, you can trigger a
context.NAME
event by doing:And it would be cool if you could also do something like:
and
context.NAME
would only trigger the first time but not the second, that way you can have plugins be configured the same way but not have to call the same context configuration callback over and over again.Other names:
context_atomic()