Skip to content

Commit

Permalink
feat: adding the reload page event (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
fe-lix- authored May 21, 2024
1 parent 30f72bb commit 89159e8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/editor-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ async function applyChanges(event) {
return false;
}

function handleReloadPage(event) {
const a = document.createElement('a');
a.setAttribute('href', event.detail);
event.target.append(a);
a.click();
}

function attachEventListners(main) {
[
'aue:content-patch',
Expand All @@ -100,6 +107,8 @@ function attachEventListners(main) {
const applied = await applyChanges(event);
if (!applied) window.location.reload();
}));

main.addEventListener('extension:reloadPage', handleReloadPage);
}

attachEventListners(document.querySelector('main'));

0 comments on commit 89159e8

Please sign in to comment.