A simple, backbone inspired view helper.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
__tests__
dist
docs
src
.npmignore
.travis.yml
CHANGELOG.md
LICENSE.md
README.md
package.json
washi.js
webpack.config.js

README.md

washi

Build Status

Basic usage

var Washi = require('washi');
var $     = Washi.$;

var Sample = {

    ui: {
        title: '.title',
    },

    events: {
        // Use ui helper selectors as aliases with {element}
        'mousedown {title}, touchstart {title}' : 'doSomething',

        // Alternatively, follow the syntax used by Backbone.Marionette
        'click @ui.title': 'doSomethingElse'
    },

    initialize: function(options) {
        this.ui.title.forEach(function(e) {
          e.innerHTML = 'Washi is for Origami';
        });
    },

    doSomething: function() {
      var text = $.pluck(this.ui.title, 'innerHTML').join(' ');
      console.log(text);
    },

    doSomethingElse: function() {
        console.log("Something else");
    }

};

var sample = Washi(Sample, {
    el: "#sample-el"
});

Corresponding with:

<div id="sample">
    <h1 class="title">Paper Crane</h1>
</div>

License

washi is released under the MIT License.


Code At Viget

Visit code.viget.com to see more projects from Viget.