fix genderef of jsgen (#5274)

This commit is contained in:
shsnow23 2017-01-25 00:59:34 +09:00 • committed by Andreas Rumpf
commit c7e54eba91
2 changed files with 21 additions and 1 deletions

20
tests/js/tderef.nim Normal file
View file

@ -0,0 +1,20 @@
discard """
output: '''true
'''
"""
import tables
type EventStore = Table[string, seq[proc ()]]
proc newEventStore(): EventStore =
initTable[string, seq[proc ()]]()
proc register(store: var EventStore, name: string, callback: proc ()) =
if not store.hasKey(name):
store[name] = @[]
store[name].add(callback)
var store = newEventStore()
store.register("test", proc () = echo "true")
store["test"][0]()