0.0.43 • Published 3 years ago

@sndcds/mvc v0.0.43

Weekly downloads
-
License
CC0-1.0
Repository
github
Last release
3 years ago

mvc

Experimental Generative MVC Library.

Install

pnpm install @sndcds/mvc

Examples

https://github.com/sndcds/mvc-example

Basic functionality

  • Create one or more views related to <div> elements in your HTML using their id attributes.
  • Create components in a tree hierarchy.
  • Send messages to views and components.

Features

  • Components are aware of their parent and child components.
  • Components can define custom logic to handle messages.

Example

const model = new AppModel()
const view = new View()

const containerA = new Component(view, 'containerA')
const containerB = new Component(view, 'containerB')
const containerC = new Component(view, 'containerC')

new Component(containerA, 'button1')
new Component(containerB, 'button2')
new Component(containerB, 'button3')

for (let i = 0; i < 9; i++) {
    new TestComponent(containerC, `component-${i}`)
}

const app = new App(model, view)
app.init('./details.json', 1)

app.buildView('root')

app.sendMessage("Hello Component")
app.sendMessageToComponent('button3', "News")

app.setProperties('component-4', {"color": "#048", "width": 100, "flag": true })
app.setProperties('component-6', {"color": "#965", "width": 100, "flag": true })
app.setProperties('component-987', {"color": "#a93", "width": 100, "flag": true })

const c = app.componentById('component-3')
console.log(c.id)
0.0.43

3 years ago

0.0.41

3 years ago

0.0.39

3 years ago

0.0.38

3 years ago

0.0.37

3 years ago

0.0.33

3 years ago

0.0.31

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago