@leansdk/leanrc
Version:
LeanRC is a MVC framework for creating graceful applications
51 lines (38 loc) • 1.32 kB
text/coffeescript
handleSendRequest = null
module.exports = (Module) ->
{
NilT
FuncG
NotificationInterface
Mediator
} = Module.NS
class ConsoleComponentMediator extends Mediator
Module
CONSOLE_MEDIATOR: 'consoleMediator'
listNotificationInterests: FuncG([], Array),
default: -> [
Module.NS.RECEIVE_RESPONSE
]
handleNotification: FuncG(NotificationInterface, NilT),
default: (notification)->
switch notification.getName()
when Module.NS.RECEIVE_RESPONSE
?.writeMessages notification.getBody()
return
onRegister: Function,
default: ->
Module.NS.ConsoleComponent.getInstance()
handleSendRequest = =>
?.subscribeEvent Module.NS.ConsoleComponent::SEND_REQUEST_EVENT, handleSendRequest
return
onRemove: Function,
default: ->
?.unsubscribeEvent Module.NS.ConsoleComponent::SEND_REQUEST_EVENT, handleSendRequest
# null
return
handleSendRequest: Function,
default: ->
Module.NS.SEND_REQUEST
return