Sha256: 6844a08364e1758780fbf3674b46bb5495cc2287c76f3007026343a63ed1ee85

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

(function (exports) {

    var localeventbus;
    var data;

    exports.init = function (eventbus) {

        localeventbus = eventbus;

        if (typeof String.prototype.startsWith != 'function') {
            String.prototype.startsWith = function (str) {
                return this.indexOf(str) == 0;
            };
        }


        eventbus.on("ui.update", function (data) {

            if (data.model.power == 1) {

                document.getElementById("iDisplay").innerHTML = data.model.weight;
            } else {

                document.getElementById("iDisplay").innerHTML = "---";
            }


            switch (data.model.power) {

                case 0:
                    $('#powerbutton').removeClass('active');
                    break;
                case 1:
                    $('#powerbutton').addClass('active');
                    break;
            }

        });

    };

    // code for changing the power status either on/off
    exports.togglepower = function togglepower() {

        localeventbus.emit("ui.command", {
            "command": "power"
        });

    };

    // code for changing to the tare button i.e tare function is called
    exports.tare = function tare() {
        localeventbus.emit("ui.command", {
            "command": "tare"
        });

    };

    //   code for changing to the print function i.e print function is called
    exports.print = function print() {

        localeventbus.emit("ui.command", {
            "command": "print"
        });
    };



})(typeof exports == 'undefined' ? this['ui'] = {} : exports);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dial_a_device_node-0.0.154 app/assets/javascripts/dial_a_device_node/devices/pce_balance_UI.js
dial_a_device_node-0.0.153 app/assets/javascripts/dial_a_device_node/devices/pce_balance_UI.js