Skip to content

Repository files navigation

starlight

Another front-end framework in Nim (working in progress). It directly compiles to the DOM and uses Proxy to implement reactivity.

Reactivity

typeCard=refobject
id: intCounter=refobject
num: int
card: Cardvar x =reactiveCounter(num: 0) # = x := Counter(num: 0)
watch:
console.log"run: ", x.?num
console.log"here: ", effectsTable
watch:
console.log"run2: ", x.?num
# use `.?` to access the attributes of Reactive
x.?num +=1
x.?num =182
x <-Counter(num: 1) # reassign; complete replacement
x.?num +=1var y =reactiveCounter(card: Card(id: 16))
watch:
console.log"card: ", y.?card.id
y.?card.id +=1
y <-Counter(card: Card(id: -1)) 

primitives

proccreateDom(): Element=var count =reactive(0)
buildHtml(`div`):
text count
button(onClick = (e: Event) => (count +=1)): text"Count"setRenderer createDom

ref object

typeCounter=refobject
c: intproccreateDom(): Element=var count =reactive(Counter(c: 12))
buildHtml(`div`):
text count.?c
button(onClick = (e: Event) => (count.?c +=1)): text"Count"setRenderer createDom

About

Another front-end framework in Nim (working in progress)

Topics

Resources

Stars

9 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages