Giter VIP home page Giter VIP logo

reactive's Introduction

reactive

Reactive template engine

Installation

$ component install component/reactive

Example

Simply invoke reactive() on the element to wish to become the "template" for obj. The given obj must emit "change" events passing (prop, val), the template will react to these changes.

var reactive = require('reactive');
reactive(el, obj);

You may also map custom callbacks for formatting or messing with an element based on a change. The element, value, and object itself are passed as arguments.

var reactive = require('reactive');
reactive(el, user, {
  birthdate: function(el, date, user){
    el.textContent = date.getFullYear() + '/' + date.getMonth() + '/' + date.getDate();
  }
});

Todo

  • composition of smaller templates instead of conditionals etc..
  • defer .render() and use .change('birthdate', fn) instead of object-literal
  • moar docs / examples

License

MIT

reactive's People

Contributors

tj avatar

Watchers

Avétis KAZARIAN avatar James Cloos 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.