//go:build js && wasm package ultraviolet import ( "syscall/js" ) type CodeComponentWeb struct { node js.Value view View change bool language string content string } func NewCodeComponentWeb(view View) *CodeComponentWeb { return &CodeComponentWeb{ view: view, change: true, } } // Component func (this *CodeComponentWeb) Build(parent Component) { this.node = WebBuildCode( this.node, parent, this.view, this.language, this.content, ) } func (this *CodeComponentWeb) Invalidate() bool { result := this.change this.change = false return result } func (this *CodeComponentWeb) Clean() { WebCleanChildren(this.node) this.change = true } // JS func (this *CodeComponentWeb) Node() js.Value { return this.node } // ComponentCode func (this *CodeComponentWeb) SetCode(language string, content string) { this.language = language this.content = content }