Socket
Book a DemoInstallSign in
Socket

meltjs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meltjs

A minimalistic yet powerful Javascript library for building web user interfaces

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

MeltJS

A minimalistic yet powerful Javascript library for building web user interfaces. MeltJS has three essential parts:

  • Model: the state of the whole application
  • Update: the only place the model can be mutated
  • Template: the way to render the model as HTML

Features

Template-based

Write expressive and concise views in pure HTML with react-like binding syntax and built-in directives e.g. each, if, ref etc.

<ul>
  <li each="item in items" if='item > 0' class.completed="{isCompleted}"></li>
</ul>

Component/Container support

Better separation of concerns and code reusability with presentational components and container components. Connect views to the model easily via containers to get a clean component structure.

One-way data flow

Predicable application state with a single model and one-way root-to-leaf data flow. Hassle-free way to dispatch the action and data to the model update functions.

Custom directives

Wrap DOM interactions inside custom directives to create more expressive views and achieve more code reusability

Example

jsfiddle Demo

// The pure functons that take the model as the argument, and return a new model
function increase ({model}) {
  return model + 1
}
function decrease ({model}) {
  return model - 1
}

Melt.app({
  elem: '#app', //the root DOM element
  model: 0,
  update: {
  	increase,
    decrease
  },
  template: 
  `<div>{model}
  	<button on-click='{increase()}'>+</button>
    <button on-click='{decrease()}'>-</button>
  </div>`
})

FAQs

Package last updated on 05 Apr 2017

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.