Documentation Index
Fetch the complete documentation index at: https://docs.screenjson.com/llms.txt
Use this file to discover all available pages before exploring further.
Constructor
config.element immediately and begins initialisation asynchronously.
element: string | HTMLElement
Either an id (as a string without the #) or an HTMLElement reference. If the id does not resolve, the constructor throws Element not found: <id>.
src: string
URL of a ScreenJSON document. Fetched and parsed by the internal DocumentLoader.
document: ScreenJSONDocument
Pre-loaded ScreenJSON document. Takes precedence over src when both are provided.
Loading precedence
When nodocument is passed, the loader looks for a source in this order:
config.src- The
?src=query parameter on the current page URL - The
data-src/data-sourceattribute on the currently executing<script>tag (CDN embed)
Callbacks
| Callback | Argument | Fires |
|---|---|---|
onLoad | ScreenJSONDocument | Once, after the document loads and the first page renders. |
onPageChange | number (1-based) | On every page change from the menu or scroll. |
onError | LoaderError | On load failure — unknown URL, fetch error, invalid document, wrong password. |