Many changes. See further for more details.

- Notification API
- New Modal API
- Vault JSON import and export
- Improved Page Cache
- Adding Context Menu API
- Adding Vault Deletion
- Fixing Sync Issues
- Implementing Share Target API
- Implementing Share To API
This commit is contained in:
Fabian
2019-03-04 21:48:31 -05:00
parent 313f5aee97
commit 3ef36ab6ca
38 changed files with 2117 additions and 1852 deletions

34
src/notifications.ts Normal file
View File

@ -0,0 +1,34 @@
import Observable from "./helper/observable";
export enum MessageType {
INFO,
WARNING,
ERROR,
SUCCESS
}
export default class Notifications {
private static messageObservableServer = new Observable<{ message: string, type: MessageType }>(false)
public static messageObservable = Notifications.messageObservableServer.getPublicApi()
public static sendNotification(message: string, type: MessageType = MessageType.INFO) {
Notifications.messageObservableServer.send({ message, type });
}
public static sendInfo(message: string) {
this.sendNotification(message, MessageType.INFO)
}
public static sendWarning(message: string) {
this.sendNotification(message, MessageType.WARNING)
}
public static sendSuccess(message: string) {
this.sendNotification(message, MessageType.SUCCESS)
}
public static sendError(error: Error | string) {
Notifications.messageObservableServer.send({ message: typeof error === "string" ? error : error.message, type: MessageType.ERROR })
}
}