Sha256: 0373a1a7764f96f7a28d4e397c74d369159f3e12452098edb47fd8463f4283d3

Contents?: true

Size: 397 Bytes

Versions: 23

Compression:

Stored size: 397 Bytes

Contents

class MyDashboard.Clock extends MyDashboard.Widget

  ready: ->
    setInterval(@startTime, 500)

  startTime: =>
    today = new Date()

    h = today.getHours()
    m = today.getMinutes()
    s = today.getSeconds()
    m = @formatTime(m)
    s = @formatTime(s)
    @set('time', h + ":" + m + ":" + s)
    @set('date', today.toDateString())

  formatTime: (i) ->
    if i < 10 then "0" + i else i

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
my_dashboard-0.5.0 vendor/assets/javascripts/my_dashboard/default_widgets/clock.coffee
my_dashboard-0.4.2 vendor/assets/javascripts/my_dashboard/default_widgets/clock.coffee
my_dashboard-0.4.1 vendor/assets/javascripts/my_dashboard/default_widgets/clock.coffee