<div class="actions">
<button id="parse-functions">Parse functions</button>
<button id="start-all" disabled>Start all</button>
- <button id="pause-all" disabled>Pause all</button>
</div>
</form>
<th>Optimized Name</th>
<th>Optimized Selector</th>
<th>Seed</th>
- <th>Status</th>
- <th>Action</th>
</tr>
</thead>
<tbody></tbody>
const form = document.querySelector('form');
const parseFunctions = document.querySelector('#parse-functions');
const startAll = document.querySelector('#start-all');
- const pauseAll = document.querySelector('#pause-all');
const outputContainer = document.querySelector('output')
const outputBody = document.querySelector('tbody');
optimizedName: null,
optimizedSelector: null,
seed: 0,
- status: 'Not started',
- action: null,
worker: null
});
}
if (state.size === 0) {
parseFunctions.disabled = false;
startAll.disabled = true;
- pauseAll.disabled = true;
return;
}
}
startAll.disabled = false;
- pauseAll.disabled = false;
outputContainer.style.display = 'block';
- status.textContent = 'Press the "START ALL" button to begin finding optimized function names for all functions, or press "START" on individual functions.';
+ status.textContent = 'Press the "START ALL" button to begin finding optimized function names for all functions.';
}
/* Business logic */
row.optimizedName = functionName;
row.optimizedSelector = hash ? hash : null;
row.seed = counter;
- row.status = completed ? 'Completed' : 'Searching';
updateUi(state);
});
}
}
- function handlePauseAll(e) {
- for (const row of state.values()) {
- row.worker.terminate();
- row.status = 'Paused';
- }
- updateUi(state);
- }
-
/* Wire up the UI to the business logic */
// On button click, call the appropriate handler
else if (e.submitter === startAll) {
handleStartAll(e);
}
- else if (e.submitter === pauseAll) {
- handlePauseAll(e);
- }
});
</script>