(flow: Flow, format: string)
| 2 | import type { Flow } from "../flow"; |
| 3 | |
| 4 | export const copy = async (flow: Flow, format: string): Promise<void> => { |
| 5 | // Safari: We need to call copyToClipboard _right away_ with a promise, |
| 6 | // otherwise we're loosing user intent and can't copy anymore. |
| 7 | const formatted = (async () => { |
| 8 | const ret = await runCommand("export", format, `@${flow.id}`); |
| 9 | if (ret.value) { |
| 10 | return ret.value; |
| 11 | } else if (ret.error) { |
| 12 | throw ret.error; |
| 13 | } else { |
| 14 | throw ret; |
| 15 | } |
| 16 | })(); |
| 17 | try { |
| 18 | await copyToClipboard(formatted); |
| 19 | } catch (err) { |
| 20 | alert(err); |
| 21 | } |
| 22 | }; |
no test coverage detected
searching dependent graphs…