documentation for 'var T' as return type
This commit is contained in:
parent
3e806a374a
commit
dd99fe61c0
5 changed files with 52 additions and 23 deletions
|
|
@ -5,16 +5,18 @@ type
|
|||
type
|
||||
TEventEmitter = object of TObject
|
||||
events*: TTable[string, TDoublyLinkedList[proc(e: TEventArgs)]]
|
||||
|
||||
proc emit*(emitter: TEventEmitter, event: string, args: TEventArgs) =
|
||||
for func in nodes(emitter.events[event]):
|
||||
func.value(args) #call function with args.
|
||||
|
||||
proc on*(emitter: var TEventEmitter, event: string, func: proc(e: TEventArgs)) =
|
||||
if not hasKey(emitter.events, event):
|
||||
var list: TDoublyLinkedList[proc(e: TEventArgs)]
|
||||
add(emitter.events,event,list) #if not, add it.
|
||||
#append(emitter.events[event], func)
|
||||
#adds the function to the event's list. I get a error here too.
|
||||
|
||||
proc emit*(emitter: TEventEmitter, event: string, args: TEventArgs) =
|
||||
for func in nodes(emitter.events[event]):
|
||||
func.value(args) #call function with args.
|
||||
|
||||
proc initEmitter(emitter: TEventEmitter) =
|
||||
emitter.events = initTable[string, TDoublyLinkedList[proc(e: TEventArgs)]]()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue