Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Rerun -button to webview and fix timer bug.

  • Loading branch information...
commit 8bdb9793fd325d1bb27723c5af86f406cc434ad2 1 parent bb1142f
@epeli authored
View
2  examples/coffee/src/hello.coffee
@@ -1,4 +1,4 @@
-console.log "Hello"
+console.log "Hello
View
15 lib/main.coffee
@@ -44,13 +44,14 @@ class Watcher extends EventEmitter
monitor.on "created", (file) => @onModified(file)
monitor.on "changed", (file) => @onModified(file)
- onModified: (filepath) ->
-
- for match in @settings.glob.split(" ")
- if gex(match).on path.basename filepath
- ok = true
- break
- return unless ok
+ onModified: (filepath, manual=false) ->
+
+ if not manual
+ for match in @settings.glob.split(" ")
+ if gex(match).on path.basename filepath
+ ok = true
+ break
+ return unless ok
# Oh we are already running. Just request restart for this change.
View
22 lib/web/clientscripts/main.coffee
@@ -87,13 +87,20 @@ class WatcherView
render: ->
@el.html @template @model
+ @button = new RerunButton
+ el: @el.find("button")
+ watcher: @
+
show: ->
@model.active = true
- @model.emit "update"
+ @render()
@el.get(0).scrollIntoView(true)
hide: ->
@model.active = false
- @model.emit "update"
+ @render()
+
+
+
class WatcherManager
@@ -114,6 +121,17 @@ class WatcherManager
w.render()
+
+class RerunButton
+
+ constructor: (ops) ->
+ @el = ops.el
+ @watcher = ops.watcher
+ @el.click =>
+ now.manualRun @watcher.model.name
+ false
+
+
class Notifies
constructor: (ops) ->
View
6 lib/web/server.coffee
@@ -42,6 +42,11 @@ everyone.on "connect", ->
@now.init ws
+
+everyone.now.manualRun = (name) ->
+ watcher = watchers[name]
+ watcher.onModified "", true
+
exports.registerWatcher = (watcher) ->
watchers[watcher.name] = watcher
@@ -57,6 +62,7 @@ exports.registerWatcher = (watcher) ->
watcher.on "end", (exitstatus) ->
everyone.now[watcher.name]?.sendExitStatus exitstatus
+
exports.start = (port=8080) ->
app.listen port
console.log "Listening on http://localhost:#{ port }/"
View
1  lib/web/views/layout.jade
@@ -48,5 +48,6 @@ html
pre {{ stdout }}
h3 STDERR
pre {{ stderr }}
+ button.rerun Rerun
body !{body}
Please sign in to comment.
Something went wrong with that request. Please try again.