component_web_container.go 759 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //go:build js && wasm
  2. package ultraviolet
  3. import (
  4. "syscall/js"
  5. )
  6. type ContainerComponentWeb struct {
  7. node js.Value
  8. view View
  9. change bool
  10. }
  11. func NewContainerComponentWeb(view View) *ContainerComponentWeb {
  12. return &ContainerComponentWeb{
  13. view: view,
  14. change: true,
  15. }
  16. }
  17. // Component
  18. func (this *ContainerComponentWeb) Build(parent Component) {
  19. this.node = WebBuildDiv(
  20. this.node,
  21. parent,
  22. this.view,
  23. "",
  24. "",
  25. AbstractHandlers{},
  26. )
  27. }
  28. func (this *ContainerComponentWeb) Invalidate() bool {
  29. result := this.change
  30. this.change = false
  31. return result
  32. }
  33. func (this *ContainerComponentWeb) Clean() {
  34. WebCleanChildren(this.node)
  35. this.change = true
  36. }
  37. // JS
  38. func (this *ContainerComponentWeb) Node() js.Value {
  39. return this.node
  40. }