(target: any, value: unknown)
| 2401 | } |
| 2402 | |
| 2403 | function setControlValue(target: any, value: unknown): void { |
| 2404 | if (isKindOf(target, "UISwitch")) { |
| 2405 | target.setOnAnimated(Boolean(value), true); |
| 2406 | sendActions(target, controlEventValueChanged); |
| 2407 | return; |
| 2408 | } |
| 2409 | if (isKindOf(target, "UISlider")) { |
| 2410 | target.value = numberValue(value); |
| 2411 | sendActions(target, controlEventValueChanged); |
| 2412 | return; |
| 2413 | } |
| 2414 | if (isKindOf(target, "UISegmentedControl")) { |
| 2415 | target.selectedSegmentIndex = numberValue(value); |
| 2416 | sendActions(target, controlEventValueChanged); |
| 2417 | return; |
| 2418 | } |
| 2419 | throw new InspectorFailure( |
| 2420 | -32011, |
| 2421 | "setValue is only supported for UISwitch, UISlider, and UISegmentedControl.", |
| 2422 | ); |
| 2423 | } |
| 2424 | |
| 2425 | function sendActions(target: any, event: number): void { |
| 2426 | if (typeof target.sendActionsForControlEvents === "function") { |
no test coverage detected