UNDP-Accelerator-Labs / platform

GNU General Public License v3.0
1 stars 0 forks source link

remove top level code #218

Closed JosuaKrause closed 6 months ago

JosuaKrause commented 6 months ago

avoid calling any code on module import. also handles implicit global variables (in case we do need globals we use window....)

Regex for all affected function names:

language|updateExplorationList|updateExplorationDatalist|updatePrompt|consentFeature|addExplorationMain|confirmExplorationPrompt|languages|mediaSize|'loading'|vocabulary|expandstats|renderModal|renderFormModal|renderLonglistFormModal|addInputNode|renderImgZoom|initExploration|exploration|toggletag|rmtag|treeinfo|changeLabel|DOMContentLoaded|DOMLoad|switchButtons|getStatus|compileContent|initToolbarInteractions|dropHandler|languages|toggleChecked|addLocation|addTxt|addEmbed|addChecklist|addRadiolist|ExcelDateToJSDate|updateDocs|updateExplorationDocs|addDocButtons|target_opts|updateCurrentExploration|updateById|checkError|renderVignette|renderTable

Changed but not async:

addSection
printTranslation

More async:

addImg|addDrawing|addTags|addAttachment|dropColumns
myjyby commented 6 months ago

Do we still use global variables? I think we should try to avoid them as much as possible.