Reputation: 3863
When a user follows a route in my application, a time consuming function begins executing.
Can i render a page on that route in the beginning of the request, then when the time-intensive function ends, send something to that page, a message, to notify the user that the time-intensive work is done?
And then, when the page that the user is on, receives the message, it displays a hidden div with a link?
Are Flash messages able to do that?
Upvotes: 0
Views: 115
Reputation: 32148
You can use WebSocket or event better Server Sent Events.
Take a look at sse-express
edit I've created a simple working example
Upvotes: 1
Reputation: 643
You can have a div in your page which will make a AJAX request to you time consuming API once the API sends the response your div will get populated with the data sent by your API.
So, The rendering process can happen in following way:
Upvotes: 0