Core libraries and tools part for pro architecture. It's a submodule - use from this perspective http://git.maniak.pro/madmaniak/pro
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
510 B
22 lines
510 B
require './dialog'
|
|
require './cache'
|
|
require './collection'
|
|
|
|
global.Requests =
|
|
|
|
counter: 1
|
|
|
|
perform: (event, params = {}) ->
|
|
params.event = event
|
|
params.r = @counter++
|
|
Dialog.send params
|
|
"#{params.r}_request"
|
|
|
|
receive: (data) ->
|
|
parsed = JSON.parse(data)
|
|
parsed.raw = data
|
|
Store.patch parsed.data if parsed.data
|
|
Dispatcher.trigger parsed.event, parsed if parsed.event
|
|
Dispatcher.trigger("#{parsed.r}_request", parsed) if parsed.r
|
|
render()
|
|
parsed
|
|
|