soma.js
Version:
soma.js is a javascript framework created to build scalable and maintainable applications.
28 lines (20 loc) • 797 B
text/coffeescript
((clock) ->
"use strict"
class clock.ClockApplication extends soma.Application
constructor: (@element) ->
super()
init: ->
# mapping rules
@injector.mapClass 'timer', clock.TimerModel, true
@injector.mapClass 'face', clock.FaceView
@injector.mapClass 'needleSeconds', clock.NeedleSeconds
@injector.mapClass 'needleMinutes', clock.NeedleMinutes
@injector.mapClass 'needleHours', clock.NeedleHours
# clock mediator
@mediators.create clock.ClockMediator, @element.querySelector('.clock')
# clock selector template
@createTemplate clock.SelectorView, @element.querySelector('.clock-selector')
start: ->
@dispatcher.dispatch 'create', clock.AnalogView
) window.clock = window.clock or {}
new clock.ClockApplication document.querySelector '.clock-app'