Skip to content

Commit

Permalink
Added maxSeconds prop, where timer starts or 'started'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarux committed Jan 31, 2018
1 parent d8e9e97 commit 800d5a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion coffee/react-countdown-clock.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ ReactCountdownClock = CreateReactClass

componentDidMount: ->
@_seconds = @props.seconds
if @props.maxSeconds > 0
@_percentOfMax = @_seconds / @props.maxSeconds
else
@_percentOfMax = 1
@_setupTimer()

componentWillUnmount: ->
Expand Down Expand Up @@ -166,7 +170,7 @@ ReactCountdownClock = CreateReactClass
@props.fontSize

_drawTimer: ->
percent = @_fraction * @_seconds + 1.5
percent = @_fraction * @_seconds * @_percentOfMax + 1.5
formattedTime = @_formattedTime()
text = if (@props.paused && @props.pausedText?) then @props.pausedText else formattedTime

Expand Down

0 comments on commit 800d5a5

Please sign in to comment.