# Global Functions

Functions RenderJS attaches to `window`: listener setup, file reading, cookies, and `document.body` shortcuts.

## window

Source: `src/prototype/window.ts`

| Method | Description |
| --- | --- |
| `_Listener(target?)` | With no argument, enables both the lazyload and SVG observers. With an argument, `target.svg` gates the lazyload observer and `target.lazyload` gates the SVG observer (see [Listener System](/listener-system) for the observer internals) |
| `$file(file)` | Wraps a `File`/`Blob` in a `FileReader.readAsDataURL`, resolving with the `load` event |
| `$cookie(key)` | Reads and URI-decodes a cookie; JSON-parses the value automatically if it looks like JSON |
| `_cookie(key, body, expire = 3600)` | Writes a cookie (`expire` in seconds); objects are `JSON.stringify`'d first |
| `$(selector)` | Module-level shortcut for `"selector".$` |
| `$all(selector)` | Module-level shortcut for `"selector".$all` |
| `_child(value, before)` / `__child(value)` | Append to / replace the children of `document.body` |
