PageRenderTime 148ms CodeModel.GetById 120ms app.highlight 1ms RepoModel.GetById 26ms app.codeStats 0ms

/lib/Session.io

http://github.com/pgregory/blackpool
Unknown | 28 lines | 24 code | 4 blank | 0 comment | 0 complexity | 9018f3b7b6f5deff4da26bea411e40a1 MD5 | raw file
 1Session := Object clone do(
 2  init := method(
 3    callbacks ::= Registry clone
 4  )
 5
 6  handle := method(request, response,
 7    request getParameters foreach(k, v,
 8      callback := callbacks find(k)
 9      if(callback,
10        callback second call(v, request)
11      )
12    )
13    k := request getParameters at("_k")
14    if(k,
15      callback := callbacks find(k)
16      if (callback, 
17        callback second call(request)
18      )
19    )
20
21    html := Canvas clone
22    html callbacks = callbacks
23    html render(root)
24    response setBody(html result)
25  )
26)
27
28