UNPKG

reblend-ui

Version:

Utilities for creating robust overlay components

20 lines (18 loc) 617 B
"use strict"; exports.__esModule = true; exports.default = useWindow; var _reblendjs = require("reblendjs"); const Context = (0, _reblendjs.createContext)(typeof window !== 'undefined' ? window : undefined); /** * The document "window" placed in React context. Helpful for determining * SSR context, or when rendering into an iframe. * * @returns the current window */ function useWindow( /* @Reblend: Transformed from function to class */ ) { const windowContext = _reblendjs.useContext.bind(this)(Context, "windowContext"); this.state.windowContext = windowContext; return this.state.windowContext; }