Emulating modal dialogs?

I have developed a module that I want to emulate modal dialogs.

I can be used to present the user with dialog panels.

It has a “confirm” style dialog and I want it to emulate the
built in confirm dialog by blocking until the user clicks one of the
buttons in the panel.

Presently, the way to do that is to provide a method for installing
a call back function that runs the subsequent code based on positive
or negative result. But that fragments code and can be a problem in
some situations.

Is there a way to do this?

possibly beyond using setTimeout ?

Thank you for time and attention;
JK

I am self taught mostly, in html/css/javascript and php on the server side.
I have a site with javascript development demos: jekillen.com/dev

Can you provide an example of your dialog? JavaScript doesn’t really have a way to force your app’s execution to stop. Using the dialog as an intermediary like you mention is a good way to solve this. More code only executes if the user provides a positive result, and the developer has to specify what the code that executes is.

I have programmed the dialog module to accept a call back function to
act as the event handlers in the dialog panels. I saw that as fragmenting
the code, but not really. The code following the call to display the dialog
is wrapped in a function def and fed to the dialog object instance, so the
visual flow of the code is not really interrupted for one inspecting it.

This is an application that I had begun some time ago and recently decided
to completely rewrite, while maintaining the same feature set. It will be a working
demo of a program that uses the modules I have developed.
If it isn’t objectionable: jekillen.com/dev has a collection of “labs” based on a CMS
system I developed. The lab for the dialogs module is lab 26. View source or developer
tools will expose the source code.
Thank you for time and attention
JK