Files
Amanda Johnston c2e1ad385d chore(many): replace any types and add tech debt tickets (#26293)
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2023-01-06 09:34:55 -06:00

33 lines
836 B
TypeScript

// TODO(FW-2827): types
interface ControllerShape<Opts, HTMLElm> {
create(options: Opts): Promise<HTMLElm>;
dismiss(data?: any, role?: string, id?: string): Promise<boolean>;
getTop(): Promise<HTMLElm | undefined>;
}
export class OverlayBaseController<Opts, Overlay> implements ControllerShape<Opts, Overlay> {
constructor(private ctrl: ControllerShape<Opts, Overlay>) {}
/**
* Creates a new overlay
*/
create(opts?: Opts): Promise<Overlay> {
return this.ctrl.create((opts || {}) as any);
}
/**
* When `id` is not provided, it dismisses the top overlay.
*/
dismiss(data?: any, role?: string, id?: string): Promise<boolean> {
return this.ctrl.dismiss(data, role, id);
}
/**
* Returns the top overlay.
*/
getTop(): Promise<Overlay | undefined> {
return this.ctrl.getTop();
}
}