node build fixed

This commit is contained in:
ra_ma
2025-09-20 14:08:38 +01:00
parent c6ebbe069d
commit 3d298fa434
1516 changed files with 535727 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
package plugin_ui
import (
"seanime/internal/notifier"
"github.com/dop251/goja"
)
type NotificationManager struct {
ctx *Context
}
func NewNotificationManager(ctx *Context) *NotificationManager {
return &NotificationManager{
ctx: ctx,
}
}
func (n *NotificationManager) bind(contextObj *goja.Object) {
notificationObj := n.ctx.vm.NewObject()
_ = notificationObj.Set("send", n.jsNotify)
_ = contextObj.Set("notification", notificationObj)
}
func (n *NotificationManager) jsNotify(call goja.FunctionCall) goja.Value {
message, ok := call.Argument(0).Export().(string)
if !ok {
n.ctx.handleTypeError("notification: notify requires a string message")
return goja.Undefined()
}
notifier.GlobalNotifier.Notify(notifier.Notification(n.ctx.ext.Name), message)
return goja.Undefined()
}