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

39 lines
1.3 KiB
TypeScript
Raw Normal View History

import { ConfigService } from 'app/core/ui-services/config.service';
2019-02-14 16:02:18 +01:00
import { IdentifiableProjectorElement, ProjectorElementOptions } from 'app/shared/models/core/projector';
import { Displayable } from 'app/site/base/displayable';
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 &&
2019-02-15 12:17:08 +01:00
deskriptor.getDialogTitle !== 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
*/
2019-02-15 12:17:08 +01:00
getDialogTitle(): string;
}
export function isProjectable(obj: any): obj is Projectable {
return !!obj && obj.getSlide !== undefined && obj.getProjectorTitle !== undefined;
}
/**
* Interface for every model, that should be projectable.
*/
export interface Projectable extends Displayable {
getProjectorTitle: () => string;
getSlide(configSerice?: ConfigService): ProjectorElementBuildDeskriptor;
}