(
message: string | null,
options: ShowMessageOptions = {},
)
| 48 | } |
| 49 | |
| 50 | export function showClipboardMessage( |
| 51 | message: string | null, |
| 52 | options: ShowMessageOptions = {}, |
| 53 | ) { |
| 54 | if (clearTimer) { |
| 55 | clearTimeout(clearTimer) |
| 56 | clearTimer = null |
| 57 | } |
| 58 | |
| 59 | emitClipboardMessage(message) |
| 60 | |
| 61 | const duration = options.durationMs ?? 3000 |
| 62 | if (message && duration > 0) { |
| 63 | clearTimer = setTimeout(() => { |
| 64 | emitClipboardMessage(null) |
| 65 | clearTimer = null |
| 66 | }, duration) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | function getDefaultSuccessMessage(text: string): string | null { |
| 71 | const preview = text.replace(/\s+/g, ' ').trim() |
no test coverage detected