Socket
Book a DemoInstallSign in
Socket

slimapp

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slimapp

a simple mvvm

0.1.2
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

slimapp Build Status codecov tested with jest

Simplest MVVM

Background

A practice of hyperapp

Usage

Checkout the examples

Slimapp provides two functions: h and app.

h

h helps you to build your vdom

var vdom = h('span', {class: 'test'}, ['text'])
// vdom: {
//  tagName: 'span',
//  key: undefined,
//  props: {class: 'test'},
//  children: ['text']
// }

app

app helps you to start your app

var view = function(actions, state) {
  return h('p', {}, [state.a])
}
var actions = {
  add: data => state => { state.a += data },
  minus: data => state => { state.a -= data }
}
var state = {
  a: 1
}
var vm = app(view, actions, state, document.body)

console.log(document.body.innerHTML) // '<p>1</p>'

vm.add(1) // '<p>2</p>'
vm.minus(3) // '<p>-1</p>'

Keywords

mvvm

FAQs

Package last updated on 02 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.