Skip to content

Event (API)

Nate the great edited this page Mar 9, 2018 · 1 revision

This object is a proxy, the value returned from threading.local(). Whenever an event is triggered, ALL the information from that client worker will be attached to this object. Keep in mind, attributes that are set to this object are not saved, which is why the info dict attribute exists on the ClientWorker.

attributes

  • listeners | dict | Containing all event names, with the corresponding callback.

This is a decorator to attach the decorated function, to the passed in event name. You can add as many functions as you want that handle only one event. The option kwargs are not used at the moment, however may be used in future releases. To call this function again, you must use .emit

  • event | str | The event name, that the function will handle.
  • options ** dict | Options to pass into the function, not used ATM.

This function is used to trigger all callbacks corresponding with the event name. Whatever is passed in as source, will be copied to the quicknet.event.ClientWorker proxy. All extra information passed into args and kwargs will be supplied to the function(s) being called.

  • source | usually, but not limited to quicknet.worker.ClientWorker | Object to be copied to quicknet.event.ClientWorker.
  • event | str | The event name to call.
  • args & kwargs | tuple & dict | Data to be passed into called functions.
Clone this wiki locally