Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/okikio/native. An initiative which aims to make it easy to create complex, light-weight, and perfor okikio.github.io/native
Something went wrong. Try again.
1234567891011121314151617181920212223242526/** * Returns browser objects that can be used on the server * @returns An object with the following properties: `{ document, CSS }`, this so `@okikio/animate` can be used in both the browser and the server */export const getBrowserObject = () => { return { document: (("document" in globalThis) ? globalThis.document : {}) as Document, CSS: (("CSS" in globalThis) ? globalThis.CSS : {}) as typeof CSS, };}
/** * Returns the browser's `document` object, except if it's a server, in which case it returns an empty object * @returns The browser document object, but allows it to be used both in the browser and the server */export const getDocument = () => { return getBrowserObject().document;}
/** * The browser's `CSS` object, except if it's a server, in which case it returns an empty object * @returns The browser CSS object, except if it's a server, in which case it returns an empty object */export const getCSS = () => { return getBrowserObject().CSS;}