API Reference
All public APIs are exported from the viewthemall package entry point.
Quick reference
Engine
| Export | Type | Description |
|---|---|---|
engine | PreviewEngine | Global singleton engine with defaultRegistry |
PreviewEngine | class | Create an isolated engine instance |
preview(file, el, opts?) | function | Shortcut to engine.preview() |
unmount(el) | function | Tear down a preview and revoke object URLs |
Registry
| Export | Type | Description |
|---|---|---|
defaultRegistry | AdapterRegistry | Global registry used by engine |
AdapterRegistry | class | Create an isolated registry |
registerAdapter(a) | function | Register an adapter in defaultRegistry |
Renderer
| Export | Type | Description |
|---|---|---|
render(model, el) | function | Render a DocumentModel into an element |
renderError(err, el) | function | Render an error state |
mount(model, el) | function | Alias for render |
registerBlockRenderer(type, fn) | function | Register a custom block renderer |
Utilities
| Export | Type | Description |
|---|---|---|
ok(value) | function | Create a success Result |
err(error) | function | Create a failure Result |
getMimeType(filename) | function | Look up MIME type by extension |
getExtension(filename) | function | Extract lowercase extension |
sanitizeHref(href) | function | Strip dangerous URL schemes |
normalizeMeta(meta) | function | Merge partial meta with defaults |