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.
31 lines
730 B
31 lines
730 B
8 years ago
|
import {observable} from "mobx";
|
||
|
|
||
|
export class Message {
|
||
|
public id: string;
|
||
|
public header: string = "";
|
||
|
public content: string = "";
|
||
|
public type: Message.Type = Message.Type.Default;
|
||
|
|
||
|
constructor(header: string, content: string = "", type: Message.Type = Message.Type.Default) {
|
||
|
this.id = "" + Math.floor(Math.random() * 1000000000);
|
||
|
this.header = header;
|
||
|
this.content = content;
|
||
|
this.type = type;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export namespace Message {
|
||
|
export enum Type {
|
||
|
Default, Success, Info, Warning, Error,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class UiStore {
|
||
|
@observable
|
||
|
public messages: Message[] = [];
|
||
|
|
||
|
public addMessage(message: Message) {
|
||
|
this.messages.push(message);
|
||
|
}
|
||
|
}
|