mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 14:20:47 +08:00
cc29cf3e10
Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci]
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import type Mithril from 'mithril';
|
|
import Alert, { AlertAttrs } from '../components/Alert';
|
|
/**
|
|
* Returned by `AlertManagerState.show`. Used to dismiss alerts.
|
|
*/
|
|
export declare type AlertIdentifier = number;
|
|
export interface AlertState {
|
|
componentClass: typeof Alert;
|
|
attrs: AlertAttrs;
|
|
children: Mithril.Children;
|
|
}
|
|
export default class AlertManagerState {
|
|
protected activeAlerts: {
|
|
[id: number]: AlertState;
|
|
};
|
|
protected alertId: number;
|
|
getActiveAlerts(): {
|
|
[id: number]: AlertState;
|
|
};
|
|
/**
|
|
* Show an Alert in the alerts area.
|
|
*
|
|
* @returns The alert's ID, which can be used to dismiss the alert.
|
|
*/
|
|
show(children: Mithril.Children): AlertIdentifier;
|
|
show(attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier;
|
|
show(componentClass: Alert, attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier;
|
|
/**
|
|
* Dismiss an alert.
|
|
*/
|
|
dismiss(key: AlertIdentifier): void;
|
|
/**
|
|
* Clear all alerts.
|
|
*/
|
|
clear(): void;
|
|
}
|