Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
796 B

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Sebastian Stehle. All rights reserved
*/
import { BehaviorSubject, Observable } from 'rxjs';
export class ModalView {
private readonly isOpen$: BehaviorSubject<boolean>;
public get isOpen(): Observable<boolean> {
return this.isOpen$.distinctUntilChanged();
}
constructor(isOpen = false,
public readonly closeAlways: boolean = false
) {
this.isOpen$ = new BehaviorSubject(isOpen);
}
public show() {
this.isOpen$.next(true);
}
public hide() {
this.isOpen$.next(false);
}
public toggle() {
let value = false;
this.isOpen.subscribe(v => {
value = v;
}).unsubscribe();
this.isOpen$.next(!value);
}
}