Skip to content

Commit

Permalink
fix: Reduce size
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyfarrell committed Nov 6, 2020
1 parent 4bd23b9 commit 0d4119c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const createDialogNode = (title, body, buttons) => htmlNode`
</c-d>
`;

function findActiveElement() {
const findActiveElement = () => {
let {activeElement} = document;
while (activeElement?.shadowRoot?.activeElement) {
activeElement = activeElement.shadowRoot.activeElement;
Expand All @@ -83,13 +83,13 @@ export const escapeEnterHandler = event => eventKeys[event.key];

let abortSignalers = [];

export function abortDialogs() {
export const abortDialogs = () => {
for (const signaler of abortSignalers) {
signaler();
}
}

export function runDialog(title, body, buttons, onkeyup = escapeEnterHandler) {
export const runDialog = (title, body, buttons, onkeyup = escapeEnterHandler) => {
const activeElement = findActiveElement();

return new Promise(resolve => {
Expand Down Expand Up @@ -147,15 +147,15 @@ export function runDialog(title, body, buttons, onkeyup = escapeEnterHandler) {
});
}

export function dialogAlert(title, body) {
export const dialogAlert = (title, body) => {
return runDialog(
title,
body,
html`<button autofocus key=Enter>OK</button>`
);
}

export function dialogConfirm(title, body, yesLabel = 'OK', noLabel = 'Cancel') {
export const dialogConfirm = (title, body, yesLabel = 'OK', noLabel = 'Cancel') => {
return runDialog(
title,
body,
Expand Down

0 comments on commit 0d4119c

Please sign in to comment.