kelo
/
console.go
114 строк · 1.9 Кб
1package godom2
3import (4"gitverse.ru/metalcore/kelo/wrapper"5)
6
7type ConsoleValuer interface {8wrapper.JSGetter9
10Assert(bool, ...any)11Clear()12Count() int13CountReset()14Debug(...any)15Dir(any)16DirXML(any)17Error(...any)18Group(...any)19GroupCollapsed(...any)20GroupEnd()21Info(...any)22Log(...any)23Table(...any)24Time(...any)25TimeEnd(...any)26TimeLog(...any)27Trace(...any)28Warn(...any)29}
30
31type Console struct {32wrapper.JS33}
34
35func NewConsole(js wrapper.JSValuer) *Console {36return &Console{*wrapper.NewJS(js)}37}
38
39func (c *Console) Assert(b bool, args ...any) {40_ = args41c.GetJS().Call("assert", b)42}
43
44func (c *Console) Clear() {45c.GetJS().Call("clear")46}
47
48func (c *Console) Count() int {49return c.GetJS().Call("count").Int()50}
51
52func (c *Console) CountReset() {53c.GetJS().Call("countReset")54}
55
56func (c *Console) Debug(args ...any) {57c.GetJS().Call("debug", args...)58}
59
60func (c *Console) Dir(args any) {61c.GetJS().Call("dir", args)62}
63
64func (c *Console) DirXML(args any) {65c.GetJS().Call("dirXML", args)66}
67
68func (c *Console) Error(args ...any) {69c.GetJS().Call("error", args...)70}
71
72func (c *Console) Group(args ...any) {73c.GetJS().Call("group", args...)74}
75
76func (c *Console) GroupCollapsed(args ...any) {77c.GetJS().Call("groupCollapsed", args...)78}
79
80func (c *Console) GroupEnd() {81c.GetJS().Call("groupEnd")82}
83
84func (c *Console) Info(args ...any) {85c.GetJS().Call("info", args...)86}
87
88func (c *Console) Log(args ...any) {89c.GetJS().Call("log", args...)90}
91
92func (c *Console) Table(args ...any) {93c.GetJS().Call("table", args...)94}
95
96func (c *Console) Time(args ...any) {97c.GetJS().Call("time", args...)98}
99
100func (c *Console) TimeEnd(args ...any) {101c.GetJS().Call("timeEnd", args...)102}
103
104func (c *Console) TimeLog(args ...any) {105c.GetJS().Call("timeLog", args...)106}
107
108func (c *Console) Trace(args ...any) {109c.GetJS().Call("trace", args...)110}
111
112func (c *Console) Warn(args ...any) {113c.GetJS().Call("warn", args...)114}
115