Skip to content

Commit

Permalink
reload deck only if mtime says so
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Sep 11, 2012
1 parent 02dbf78 commit 8fc3f5c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bin/tkn
Expand Up @@ -142,14 +142,19 @@ def read_command
end end
end end


n = 0 n = 0
deck = ARGV[0]
mtime = nil

loop do loop do
print clear_screen print clear_screen


# We load the presentation in every iteration to ease editing and reload. current_mtime = File.mtime(deck)
# This is fast enough, so who cares about caching. if mtime != current_mtime
$slides = [] $slides = []
load ARGV[0] load deck
mtime = current_mtime
end


n = [[0, n].max, $slides.length - 1].min n = [[0, n].max, $slides.length - 1].min
render($slides[n]).each_char do |c| render($slides[n]).each_char do |c|
Expand Down

0 comments on commit 8fc3f5c

Please sign in to comment.