fullstorydev / fullstory-browser-sdk

Official FullStory SDK for JavaScript, for web browsers
MIT License
55 stars 17 forks source link

Add isInitialized #130

Closed ralfstory closed 2 years ago

ralfstory commented 2 years ago

This PR adds an isInitialized function which wraps window._fs_initialized. This is useful for code that could potentially repeatedly call init (like useEffects), leading to noisy console warnings. Checking for initialization before calling init would be helpful in this situation.

patrick-fs commented 2 years ago

@ralfstory would you also please include isIniatlized in the type definition (index.d.ts) and update the readme?

luser commented 2 years ago

I rebased your changes and squashed them while I was at it. I dropped the changes to package-lock.json since there were conflicts and they didn't seem relevant to the change at hand. I'll merge this now, thanks for the change!

ralfstory commented 2 years ago

@luser thanks for getting to this!! no longer needed it for what I was working on, so it was easy to fall through - still a helpful addition in any case!