123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- define([
- '../../Core/defined',
- '../../Core/defineProperties',
- '../../Core/DeveloperError',
- '../../ThirdParty/knockout',
- '../createCommand'
- ], function(
- defined,
- defineProperties,
- DeveloperError,
- knockout,
- createCommand) {
- "use strict";
-
- var ProviderViewModel = function(options) {
-
- if (!defined(options.name)) {
- throw new DeveloperError('options.name is required.');
- }
- if (!defined(options.tooltip)) {
- throw new DeveloperError('options.tooltip is required.');
- }
- if (!defined(options.iconUrl)) {
- throw new DeveloperError('options.iconUrl is required.');
- }
- if (typeof options.creationFunction !== 'function') {
- throw new DeveloperError('options.creationFunction is required.');
- }
-
- var creationCommand = options.creationFunction;
- if (!defined(creationCommand.canExecute)) {
- creationCommand = createCommand(creationCommand);
- }
- this._creationCommand = creationCommand;
-
- this.name = options.name;
-
- this.tooltip = options.tooltip;
-
- this.iconUrl = options.iconUrl;
- knockout.track(this, ['name', 'tooltip', 'iconUrl']);
- };
- defineProperties(ProviderViewModel.prototype, {
-
- creationCommand : {
- get : function() {
- return this._creationCommand;
- }
- }
- });
-
- return ProviderViewModel;
- });
|