Sha256: 9c3d7af418e06a0f08dad8583ea65725a8a0562d1144332b5087fda657c29a28

Contents?: true

Size: 1.97 KB

Versions: 7

Compression:

Stored size: 1.97 KB

Contents

/*global define*/
define(['Core/defaultValue', 'Core/defined', 'Core/defineProperties', 'Core/DeveloperError', 'ThirdParty/knockout'], function(
        defaultValue,
        defined,
        defineProperties,
        DeveloperError,
        knockout) {
    "use strict";

    /**
     * A view model which exposes the properties of a toggle button.
     * @alias ToggleButtonViewModel
     * @constructor
     *
     * @param {Command} command The command which will be executed when the button is toggled.
     * @param {Object} [options] Options defining the button's properties.
     * @param {Boolean|Observable} [options.toggled=false] A boolean, or observable, indicating whether the button should be initially toggled.
     * @param {String|Observable} [options.tooltip=''] A string, or observable, containing the button's tooltip.
     */
    var ToggleButtonViewModel = function(command, options) {
        if (!defined(command)) {
            throw new DeveloperError('command is required.');
        }

        this._command = command;

        options = defaultValue(options, defaultValue.EMPTY_OBJECT);

        /**
         * Gets or sets whether the button is currently toggled.  This property is observable.
         * @type {Boolean}
         * @default false
         */
        this.toggled = defaultValue(options.toggled, false);

        /**
         * Gets or sets the button's tooltip.  This property is observable.
         * @type {String}
         * @default ''
         */
        this.tooltip = defaultValue(options.tooltip, '');

        knockout.track(this, ['toggled', 'tooltip']);
    };

    defineProperties(ToggleButtonViewModel.prototype, {
        /**
         * Gets the command which will be executed when the button is toggled.
         * @memberof ToggleButtonViewModel.prototype
         * @type {Command}
         */
        command : {
            get : function() {
                return this._command;
            }
        }
    });

    return ToggleButtonViewModel;
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cesium-0.24.1 app/assets/javascripts/Widgets/ToggleButtonViewModel.js
cesium-0.24.0 app/assets/javascripts/Widgets/ToggleButtonViewModel.js
cesium-0.23.0 app/assets/javascripts/Widgets/ToggleButtonViewModel.js
cesium-0.22.0 app/assets/javascripts/Widgets/ToggleButtonViewModel.js
cesium-0.21.1 app/assets/javascripts/Widgets/ToggleButtonViewModel.js
cesium-0.21 app/assets/javascripts/Widgets/ToggleButtonViewModel.js
cesium-0.20.0 app/assets/javascripts/Widgets/ToggleButtonViewModel.js