Use proper events for global event handlers

This commit is contained in:
Andreas Nedbal 2022-01-03 15:04:23 +01:00 committed by Andreas Nedbal
parent 36acd25395
commit f7e4fc76cb
2 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ import initLists from 'retrospring/features/lists';
start(); start();
document.addEventListener('turbolinks:load', initAnswerbox); document.addEventListener('turbolinks:load', initAnswerbox);
document.addEventListener('turbolinks:load', initInbox); document.addEventListener('DOMContentLoaded', initInbox);
document.addEventListener('DOMContentLoaded', initUser); document.addEventListener('DOMContentLoaded', initUser);
document.addEventListener('turbolinks:load', initSettings); document.addEventListener('turbolinks:load', initSettings);
document.addEventListener('DOMContentLoaded', initLists); document.addEventListener('DOMContentLoaded', initLists);

View File

@ -6,10 +6,10 @@ import { generateQuestionHandler } from './generate';
export default (): void => { export default (): void => {
registerEvents([ registerEvents([
{ type: 'click', target: document.querySelector('#ib-generate-question'), handler: generateQuestionHandler }, { type: 'click', target: '#ib-generate-question', handler: generateQuestionHandler, global: true },
{ type: 'click', target: document.querySelector('#ib-delete-all'), handler: deleteAllQuestionsHandler }, { type: 'click', target: '#ib-delete-all', handler: deleteAllQuestionsHandler, global: true },
{ type: 'click', target: document.querySelector('#ib-delete-all-author'), handler: deleteAllAuthorQuestionsHandler }, { type: 'click', target: '#ib-delete-all-author', handler: deleteAllAuthorQuestionsHandler, global: true },
{ type: 'submit', target: document.querySelector('#author-form'), handler: authorSearchHandler } { type: 'submit', target: '#author-form', handler: authorSearchHandler, global: true }
]); ]);
registerInboxEntryEvents(); registerInboxEntryEvents();