| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview A command is an abstraction of an action a user can do in the | 6 * @fileoverview A command is an abstraction of an action a user can do in the |
| 7 * UI. | 7 * UI. |
| 8 * | 8 * |
| 9 * When the focus changes in the document for each command a canExecute event | 9 * When the focus changes in the document for each command a canExecute event |
| 10 * is dispatched on the active element. By listening to this event you can | 10 * is dispatched on the active element. By listening to this event you can |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 /** | 275 /** |
| 276 * Whether the target can execute the command. Setting this also stops the | 276 * Whether the target can execute the command. Setting this also stops the |
| 277 * propagation. | 277 * propagation. |
| 278 * @type {boolean} | 278 * @type {boolean} |
| 279 */ | 279 */ |
| 280 canExecute_: false, | 280 canExecute_: false, |
| 281 get canExecute() { | 281 get canExecute() { |
| 282 return this.canExecute_; | 282 return this.canExecute_; |
| 283 }, | 283 }, |
| 284 set canExecute(canExecute) { | 284 set canExecute(canExecute) { |
| 285 this.canExecute_ = canExecute; | 285 this.canExecute_ = !!canExecute; |
| 286 this.stopPropagation(); | 286 this.stopPropagation(); |
| 287 } | 287 } |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 // Export | 290 // Export |
| 291 return { | 291 return { |
| 292 Command: Command, | 292 Command: Command, |
| 293 CanExecuteEvent: CanExecuteEvent | 293 CanExecuteEvent: CanExecuteEvent |
| 294 }; | 294 }; |
| 295 }); | 295 }); |
| OLD | NEW |