UNPKG

react-beautiful-dnd

Version:

Beautiful, accessible drag and drop for lists with React.js

27 lines (21 loc) 582 B
// @flow const supportedEventName: string = ((): string => { const base: string = 'visibilitychange'; // Server side rendering if (typeof document === 'undefined') { return base; } // See https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API const candidates: string[] = [ base, `ms${base}`, `webkit${base}`, `moz${base}`, `o${base}`, ]; const supported: ?string = candidates.find( (eventName: string): boolean => `on${eventName}` in document, ); return supported || base; })(); export default supportedEventName;