Stabzs / Angular2-Toaster

Angular2-toaster is an asynchronous, non-blocking Angular Toaster Notification library
MIT License
334 stars 93 forks source link

Angular Universal SSR support request #237

Open tylerforsythe opened 3 years ago

tylerforsythe commented 3 years ago

Hello,

Are there any plans to support Angular Universal SSR? That is, checking isPlatformBrowser() before attempting to reference the window object? Thanks!

Stabzs commented 3 years ago

It wasn't something that was explicitly planned. That said, it seems like the only issue is that window.setTimeout calls are being executed server-side and wrapping with a check would enable SSR?

tylerforsythe commented 3 years ago

My understanding is that yes: protecting just those calls would enable SSR. I'd do it myself but don't know the first thing about developing/testing a node module.

Stabzs commented 3 years ago

This isn't something I've spent much time testing either, although the change is trivial. I have a set of changes I'm putting together for release this week. I'll add this and I can make future adjustments based on implementation feedback.

tylerforsythe commented 3 years ago

That'd be excellent; thank you so much! Looking forward to trying it out.