         cell.text e.result
         dfd.resolve e.result
     dfd.promise
+
+  toggleWatchVariable: (variableName) ->
+    row = @find('#spark-ide-cloud-variables [data-id=' + variableName + ']')
+    watchButton = row.find('td:eq(4) button')
+    refreshButton = row.find('td:eq(3) button')
+    valueCell = row.find('td:eq(2)')
+
+    if watchButton.hasClass 'selected'
+      watchButton.removeClass 'selected'
+      refreshButton.removeAttr 'disabled'
+      clearInterval @watchers[variableName]
+      delete @watchers[variableName]
+    else
+      watchButton.addClass 'selected'
+      refreshButton.attr 'disabled', 'disabled'
+      @watchers[variableName] = setInterval =>
+        @refreshVariable variableName
+      , 5000
 
   listFunctions: ->
     functions = SettingsHelper.get 'functions'

        row.find('td:eq(3) button').on 'click', (event) =>
          @refreshVariable $(event.currentTarget).parent().parent().attr('data-id')

        table.find('tbody').append row.find('tbody >')

      @variables.append table

  refreshVariable: (variableName) ->
    dfd = whenjs.defer()
    @client ?= new ApiClient SettingsHelper.get('apiUrl'), SettingsHelper.get('access_token')
    cell = @find('#spark-ide-cloud-variables [data-id=' + variableName + '] td:eq(2)')
    cell.addClass 'loading'
    cell.text ''
    promise = @client.getVariable SettingsHelper.get('current_core'), variableName
    promise.done (e) =>
      if !!e.ok
