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