factory.go 603 B

12345678910111213141516171819202122232425262728293031
  1. //go:build js && wasm
  2. package ultraviolet
  3. type Model map[string]any
  4. type Controller map[string]any
  5. type ComponentOptions struct {
  6. View View
  7. Model Model
  8. Controller Controller
  9. }
  10. type Factory interface {
  11. NewRoot(options any) Component
  12. NewContainer(options any) Component
  13. NewButton(options any) Component
  14. NewImage(options any) Component
  15. NewMarkdown(options any) Component
  16. NewFrame(options any) Component
  17. NewCode(options any) Component
  18. }
  19. func NewFactory(platform int) Factory {
  20. switch platform {
  21. case PLATFORM_WEB:
  22. return NewWebFactory()
  23. default:
  24. return NewWebFactory()
  25. }
  26. }