GithubHelp home page GithubHelp logo

rpeanut / mithril.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mithriljs/mithril.js

0.0 2.0 0.0 7.88 MB

A Javascript Framework for Building Brilliant Applications (development repo)

Home Page: http://mithril.js.org

License: MIT License

JavaScript 22.97% HTML 76.07% CSS 0.96%

mithril.js's Introduction

JS.ORG Join the chat at https://gitter.im/lhorie/mithril.js Build Status

Mithril

A Javascript Framework for Building Brilliant Applications

See the website for documentation and the wiki for more

There's also a blog and a mailing list


What is Mithril?

Mithril is a client-side MVC framework - a tool to organize code in a way that is easy to think about and to maintain.

Light-weight

  • Only 7.8 kB gzipped, no dependencies
  • Small API, small learning curve

Robust

  • Safe-by-default templates
  • Hierarchical MVC via components

Fast

  • Virtual DOM diffing and compilable templates
  • Intelligent auto-redrawing system

Sample code

//namespace
var app = {};

//model
app.PageList = function() {
	return m.request({method: "GET", url: "pages.json"});
};

//controller
app.controller = function() {
	var pages = app.PageList();
	return {
		pages: pages,
		rotate: function() {
			pages().push(pages().shift());
		}
	}
};

//view
app.view = function(ctrl) {
	return [
		ctrl.pages().map(function(page) {
			return m("a", {href: page.url}, page.title);
		}),
		m("button", {onclick: ctrl.rotate}, "Rotate links")
	];
};


//initialize
m.mount(document.getElementById("example"), app);

Learn more

mithril.js's People

Contributors

lhorie avatar barneycarroll avatar pelonpelon avatar zolmeister avatar pistolero avatar pygy avatar shibukawa avatar zzmp avatar tobyzerner avatar bsuh avatar cbowdon avatar maranomynet avatar oleg8sh avatar yolk avatar richardasymmetric avatar epidemian avatar whoaa512 avatar bewildergeist avatar dgilland avatar mambocab avatar iamjohnlong avatar eiriksm avatar tivac avatar futurist avatar webcss avatar ludbek avatar ysimonson avatar sloria avatar mrtracy avatar labeg avatar

Watchers

James Cloos avatar wansheng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.