Skip to content

Commit 2d565cd

Browse files
refactor: extract copy reset delay
Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com> Agent-Logs-Url: https://github.com/copilot-dev-days/agent-lab-typescript/sessions/87511d3c-3e87-471f-8f89-7d0234d57e7d
1 parent b0a5fd2 commit 2d565cd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

docs/step.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181

8282
const GITHUB_RAW_BASE = 'https://raw.githubusercontent.com/copilot-dev-days/agent-lab-typescript/main/workshop/';
8383
const CHECKBOX_STATE_KEY_PREFIX = 'workshop-checkboxes:';
84+
const COPY_STATUS_RESET_DELAY = 2000;
8485
const pendingCopyResetTimers = new Set();
8586

8687
function getCurrentStepId() {
@@ -237,13 +238,13 @@
237238
const liveRegion = document.createElement('span');
238239
liveRegion.className = 'sr-only';
239240
liveRegion.setAttribute('aria-live', 'polite');
241+
let resetTimer;
240242

241243
const resetButtonState = () => {
242244
copyButton.textContent = 'Copy';
243245
copyButton.dataset.state = 'idle';
244246
liveRegion.textContent = '';
245247
};
246-
let resetTimer;
247248

248249
copyButton.addEventListener('click', async () => {
249250
if (resetTimer) {
@@ -265,7 +266,7 @@
265266
resetTimer = setTimeout(() => {
266267
pendingCopyResetTimers.delete(resetTimer);
267268
resetButtonState();
268-
}, 2000);
269+
}, COPY_STATUS_RESET_DELAY);
269270
pendingCopyResetTimers.add(resetTimer);
270271
});
271272

0 commit comments

Comments
 (0)