view service/laundry/static/gui.js @ 99:3c583603f261

start switch to goweb, for improved incoming payload handling Ignore-this: 18f1a3f3fef04a22a1d4e84a6e5e09ca
author drewp@bigasterisk.com
date Sat, 31 Aug 2013 11:24:09 -0700
parents 27a685ce2e5d
children 64ad5ad17dc1
line wrap: on
line source

'use strict';


function Ctrl($scope, $http) {
    function refresh() {
        $http.get("status").success(function (data) {
            $scope.status = data;
        });
    }
    refresh();
    $scope.setLed = function (value) {
        $http.put("led", value).succeed(function () {
            refresh();
        });
    };
    $scope.temporaryUnlock = function () {
        var seconds = 3;
        $http.put("strike/temporaryUnlock", {seconds: seconds}).succeed(function () {
            refresh();
            setTimeout(function () { refresh(); }, (seconds + .1) * 1000);
        });
    };
    $scope.beep = function () {
        $http.put("speaker/beep").succeed(function () {
            $scope.speakerStatus = "sent at " + new Date();
        });
    }
}