OpenSlides/client/src/app/site/base/projectable.ts

40 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Displayable } from 'app/site/base/displayable';
2019-02-14 16:02:18 +01:00
import { IdentifiableProjectorElement, ProjectorElementOptions } from 'app/shared/models/core/projector';
import { SlideOptions } from './slide-options';
export function isProjectorElementBuildDeskriptor(obj: any): obj is ProjectorElementBuildDeskriptor {
const deskriptor = <ProjectorElementBuildDeskriptor>obj;
return (
2019-02-13 10:12:55 +01:00
!!deskriptor &&
deskriptor.slideOptions !== undefined &&
deskriptor.getBasicProjectorElement !== undefined &&
deskriptor.getTitle !== undefined
);
}
export interface ProjectorElementBuildDeskriptor {
slideOptions: SlideOptions;
projectionDefaultName?: string;
2019-02-14 16:02:18 +01:00
getBasicProjectorElement(options: ProjectorElementOptions): IdentifiableProjectorElement;
/**
* The title to show in the projection dialog
*/
getTitle(): string;
}
export function isProjectable(obj: any): obj is Projectable {
2019-02-13 10:12:55 +01:00
if (obj) {
return (<Projectable>obj).getSlide !== undefined;
} else {
return false;
}
}
/**
* Interface for every model, that should be projectable.
*/
export interface Projectable extends Displayable {
getSlide(): ProjectorElementBuildDeskriptor;
}