UNPKG

@readium/shared

Version:

Shared models to be used across other Readium projects and implementations in Typescript

20 lines (14 loc) 509 B
import { Metadata } from '../Metadata'; import { Presentation } from './Presentation'; // Presentation extensions for [Metadata] declare module '../Metadata' { export interface Metadata { getPresentation(): Presentation | undefined; } } Metadata.prototype.getPresentation = function(): Presentation | undefined { const presentation = this.otherMetadata?.['presentation'] || this.otherMetadata?.['rendition']; if (!presentation) return; return Presentation.deserialize(presentation); };