(function() {
    'use strict';

    dashboard.counter = dashboard.counter || {};

    var $counter;

    dashboard.counter.init = function() {
        $counter = $('#dashboardItemCounter');
        var $boxContainer = dashboard.$container.find('.boxContainer');

        $boxContainer.mutationObserver(function(mutation) {
            dashboard.counter.setValue($boxContainer.children().length);
        });
        
        // później ma miejsce usuwanie za pomocą destroy:
        // $boxContainer.mutationObserver('destroy');
    };

    dashboard.counter.setValue = function (value) {
        $counter.text(value);
    };

})();
