(options: ToggleOptions)
| 1444 | * @since 4.0.0 |
| 1445 | */ |
| 1446 | export const Toggle = (options: ToggleOptions): Prompt<boolean> => { |
| 1447 | const opts: ToggleOptionsReq = { |
| 1448 | initial: false, |
| 1449 | active: "on", |
| 1450 | inactive: "off", |
| 1451 | ...options |
| 1452 | } |
| 1453 | return Custom(opts.initial, { |
| 1454 | render: handleToggleRender(opts), |
| 1455 | process: handleToggleProcess, |
| 1456 | clear: () => handleToggleClear(opts) |
| 1457 | }) |
| 1458 | } |
| 1459 | |
| 1460 | const proto = { |
| 1461 | ...Effectable.Prototype<Prompt<any>>({ |