First pass at auto compile ctrl

This commit is contained in:
Alasdair Smith 2017-09-01 15:31:08 +01:00
parent c42b08fcff
commit dab799a81b
3 changed files with 17 additions and 1 deletions

View file

@ -1,4 +1,5 @@
div.full-size.pdf(ng-controller="PdfController")
.FIXME(ng-controller="AutoCompileController")
.toolbar.toolbar-tall
.btn-group(
dropdown,

View file

@ -1,7 +1,8 @@
define [
"ide/pdf/controllers/PdfController"
"ide/pdf/controllers/PdfViewToggleController"
"ide/pdfng/directives/pdfJs"
"ide/pdfng/directives/pdfJs",
"ide/pdf/controllers/AutoCompileController"
], () ->
class PdfManager
constructor: (@ide, @$scope) ->

View file

@ -0,0 +1,14 @@
define [
"base"
], (App) ->
App.controller "AutoCompileController", ["$scope", "ide", ($scope, ide) ->
hasLintingError = false
ide.$scope.$on "ide:opAcknowledged", _.debounce(() ->
if (!hasLintingError)
$scope.recompile()
, 3000)
ide.$scope.$on "ide:lintingError", (e, hasError) ->
hasLintingError = hasError
]