roundtableAI / roundtable-js

Open-source research-grade programmatic survey software
https://surveys.roundtable.ai
Apache License 2.0
259 stars 6 forks source link

Add beforeFinish and beforeLoad handlers to page load #25

Open mdahardy opened 3 months ago

mdahardy commented 3 months ago

We removed callbacks from the survey logic as most logic can just be handled in the async function itself. However, a callback that calls after the document body has loaded, but before it displays, could be useful for e.g. animating the display of the page which is difficult to do now. Because all logic that happens before the document body has loaded can be handled in the async function, the scope of these listeners can be relatively constrained to handle the logic between load/display and submit/remove display.

mdahardy commented 3 months ago

This could also be used for adding custom logic, e.g. adding an event listener to submit the page on "Enter".

mdahardy commented 3 weeks ago

Note: We recently wanted to prevent pasting into open-end questions. This was quite difficult to do with the current implementation, but would be easy if we had a beforeLoad handler. Bumping this up in priority.