Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2017
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Substitute for windows messages

    As we know the windows messages also pause execution, which is desirable. For months now I have been trying to emulate the behavior because I wanted a better looking message box.

    The issue is how to actually truly pause JavaScript execution. Every scrap of information I have read says this is not possible. The windows alert, confirm, etc. are part of the implementation by IE, Chrome, etc.

    There must be a way since I see this done on sites like Amazon. So, does any one have the solution.....

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    7,757
    Thanks
    35
    Thanked 1,040 Times in 1,036 Posts
    What exactly is your question? Do you want to pause JS exicution or make a better looking message box or both? Of cource you do know that posting code is required?

    In the back of my head I am thinking that you might want a JS function.
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    New Coder
    Join Date
    Jun 2017
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am looking if there is a way to replicate the behavior of the windows messaging. My code is irrelevant in this case. Something similar to

    throw "stop execution"

    The issue with this is that it stops all execution and then nothing else will work. I just want to show a custom message and then wait for user entry.

  4. #4
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    3,086
    Thanks
    4
    Thanked 447 Times in 436 Posts
    You need to stop thinking in terms of linear execution and think "asynchronously" // "deferred".

    All the code that would run AFTER your modal dialog (what DIY 'windows' on a page are called) put it into a function, and have the 'ok' button in your window handler call that while/after it's closing the modal.

    -- edit --

    Just to give you an idea what I mean.

    Index of /for_others/cxxxv/ - CutCodeDown
    Last edited by deathshadow; Jun 24th, 2018 at 12:58 AM.
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com

  5. #5
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Location
    Here
    Posts
    3,822
    Thanks
    58
    Thanked 687 Times in 682 Posts
    I never had a use for this, but I understand that a couple of ex-regulars nutted this one out while looking at a related issue. Here's the discussion:

    https://www.codingforums.com/post-a-...-function.html


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •