Skip to content

Conversation

@lukasbuenger
Copy link
Contributor

This PR introduces a tiny existence check on the global window object before accessing it further. With this small change, this library, inline with its upstream dependency, would be fully SSR-ready.

Copy link
Owner

@Lodin Lodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lukasbuenger, thanks for the contribution and sorry to keep you waiting. I have a single change request, and when you add it to your PR, I would be glad to merge it.

only do single existence check

Co-authored-by: Vlad Rindevich <vladrin@vaadin.com>
@lukasbuenger lukasbuenger requested a review from Lodin May 28, 2021 06:57

const useIdleCallback =
'requestIdleCallback' in window &&
typeof requestIdleCallback !== 'undefined'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to add && to the condition

Suggested change
typeof requestIdleCallback !== 'undefined'
typeof requestIdleCallback !== 'undefined' &&

@Lodin
Copy link
Owner

Lodin commented Aug 16, 2021

@lukasbuenger, any updates for this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants