soma.js
Version:
soma.js is a javascript framework created to build scalable and maintainable applications.
38 lines (31 loc) • 776 B
text/coffeescript
((clock) ->
"use strict"
class clock.TimerModel
constructor: () ->
= []
= {}
i = 0
l = 0
tick = () =>
()
i = 0
l = .length
while i < l
[i]
i++
setInterval tick, 1000
()
update: () ->
.now = new Date()
.hours = .now.getHours()
.minutes = .now.getMinutes()
.seconds = .now.getSeconds()
.milliseconds = .now.getMilliseconds()
.day = .now.getDay() + 1
.date = .now.getDate()
.month = .now.getMonth() + 1
add: (callback) ->
.push callback
remove: (callback) ->
.splice .indexOf callback, 1
) window.clock = window.clock or {}