chromium/third_party/blink/perf_tests/speedometer20/resources/todomvc/dependency-examples/flight/flight/app/js/ui/toggle_all.js

/*global define */
'use strict';

define([
    'flight/lib/component'
], function (defineComponent) {
    function toggleAll() {
        this.toggleAllComplete = function () {
            this.trigger('uiToggleAllRequested', {
                completed: this.$node.is(':checked')
            });
        };

        this.toggleCheckbox = function (e, data) {
            this.node.checked = !data.remaining;
        };

        this.after('initialize', function () {
            this.on('click', this.toggleAllComplete);
            this.on(document, 'dataStatsCounted', this.toggleCheckbox);
        });
    }

    return defineComponent(toggleAll);
});