Download Latest Version v4.5.2 source code.tar.gz (2.7 MB)
Email in envelope

Get an email when there's a new version of happyx

Home / v0.5.1
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2023-04-18 896 Bytes
v0.5.1 source code.tar.gz 2023-04-18 141.9 kB
v0.5.1 source code.zip 2023-04-18 149.2 kB
v0.5.1.tar.gz 2023-04-18 141.9 kB
v0.5.1.zip 2023-04-18 149.2 kB
Totals: 5 Items   583.0 kB 0

SPA, States And More Other 🎉

In this release we added powerful state management and components!

Components

Project structure:

project/
-- components/
-- -- hello_world.nim
-- main.nim

project/components/hello_world.nim

:::nim
import happyx

component MyComponent:
  counter: int

  `template`:
    {self.counter}
    button:
      "Increase"
      @click:
        self.counter += 1

  `script`:
    echo self.counter

  `style`:
    """
    button {
      background: #212121;
      color: #dfdfdf;
      padding: 12px {self.counter + 1}px;
    }
    """

project/main.nim

:::nim
import happyx

var app = registerApp()
app.routes:
  "/":
    component MyComponent(counter = 5)
app.start()
Source: README.md, updated 2023-04-18