|
|
|
|
|
by Stratoscope
4271 days ago
|
|
> [Wow Alert] overrides the existing alert function. That is an absolutely terrible idea. It overrides alert() but doesn't - and can't - duplicate its blocking behavior. I'm not criticizing you for liking the idea! I can see its appeal myself. I'm criticizing Wow Alert for letting a nifty idea result in bad sofware design. https://github.com/al0p/wow-alert/blob/b3224bc34fea6a49aac2d... Their version of window.alert() returns immediately after setting up the alert window and actions - because that's all it is capable of. If you just drop this into existing code without inspecting each and every alert() call to make sure it doesn't rely on the blocking - both in your own code and every library you use - you will definitely break things. Far better to leave alert() alone and make this a separate function with its own name. |
|
If you really wanted to, I think you could set up an endpoint on your server to be long polled with synchronous XHR in a while loop, while you set up the popup in an iframe. When the popup is clicked, you send a notification to the server so the next synchronous request returns 200 and you dispose of the iframe.
On searching, I discover someone else has had this crazy idea already - http://stackoverflow.com/questions/16934667/what-methods-are...