mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🎨 消息提示支持显示多条 https://github.com/siyuan-note/siyuan/issues/4875
This commit is contained in:
parent
eb78e27d9c
commit
e4219bf679
4 changed files with 27 additions and 30 deletions
|
|
@ -19,6 +19,7 @@ package util
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/melody"
|
||||
)
|
||||
|
||||
|
|
@ -126,19 +127,14 @@ func PushTxErr(msg string, code int, data interface{}) {
|
|||
BroadcastByType("main", "txerr", code, msg, data)
|
||||
}
|
||||
|
||||
func PushMsg(msg string, timeout int) {
|
||||
evt := NewCmdResult("msg", 0, PushModeBroadcast, 0)
|
||||
evt.Msg = msg
|
||||
evt.Data = map[string]interface{}{"closeTimeout": timeout}
|
||||
PushEvent(evt)
|
||||
func PushMsg(msg string, timeout int) string {
|
||||
ret := gulu.Rand.String(7)
|
||||
BroadcastByType("main", "msg", 0, msg, map[string]interface{}{"id": ret, "closeTimeout": timeout})
|
||||
return ret
|
||||
}
|
||||
|
||||
func PushErrMsg(msg string, timeout int) {
|
||||
evt := NewCmdResult("msg", 0, PushModeBroadcast, 0)
|
||||
evt.Code = -1
|
||||
evt.Msg = msg
|
||||
evt.Data = map[string]interface{}{"closeTimeout": timeout}
|
||||
PushEvent(evt)
|
||||
BroadcastByType("main", "msg", -1, msg, map[string]interface{}{"closeTimeout": timeout})
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
@ -156,20 +152,20 @@ func PushEndlessProgress(msg string) {
|
|||
}
|
||||
|
||||
func PushProgress(code, current, total int, msg string) {
|
||||
evt := NewCmdResult("progress", 0, PushModeBroadcast, 0)
|
||||
evt.Msg = msg
|
||||
evt.Code = code
|
||||
evt.Data = map[string]interface{}{
|
||||
BroadcastByType("main", "progress", code, msg, map[string]interface{}{
|
||||
"current": current,
|
||||
"total": total,
|
||||
}
|
||||
PushEvent(evt)
|
||||
})
|
||||
}
|
||||
|
||||
// PushClearMsg 会清空消息提示以及进度遮罩。
|
||||
func PushClearMsg() {
|
||||
evt := NewCmdResult("cmsg", 0, PushModeBroadcast, 0)
|
||||
PushEvent(evt)
|
||||
// PushClearMsg 会清空指定消息。
|
||||
func PushClearMsg(msgId string) {
|
||||
BroadcastByType("main", "cmsg", 0, "", map[string]interface{}{"id": msgId})
|
||||
}
|
||||
|
||||
// PushClearProgress 取消进度遮罩。
|
||||
func PushClearProgress() {
|
||||
BroadcastByType("main", "cprogress", 0, "", nil)
|
||||
}
|
||||
|
||||
func PushDownloadProgress(id string, percent float32) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue