ractive-adaptors-modella

    0.0.2 • Public • Published

    Ractive-adaptors-modella

    Build Status

    Ractive adaptor plugin for modella.

    Installation

    Component:

    component install staygrimm/ractive-adaptors-modella
    

    npm:

    npm install ractive-adaptors-modella
    

    Example

    var modellaAdaptor = require('ractive-adaptors-modella'),
        modella = require('modella'),
        Ractive = require('ractive'),
        User,
        user
     
    User = modella('User')
        .attr('name')
        .attr('email');
     
    user = new User({name: 'River', email: 'river.grimm@gmail.com'});
     
    view = new Ractive({
        template: '<span>{{name}} - {{email}}</span>',
        data: user,
        adapt: [modellaAdaptor([User]);]
    });
     
    user.name('River Grimm');
     
    view.toHTML(); // <span>River Grimm - river.grimm@gmail.com</span>

    API

    Adaptor([constructors])

    Unline other Ractive adaptors, we need to initialize this adaptor with an array of Modella constructors. This is required as there's no easy method to discover if a model has been created by Modella. Instead, we have to check against the constructors Modella returns.

    Test

    npm install && make test

    License

    GPL v2

    Keywords

    none

    Install

    npm i ractive-adaptors-modella

    DownloadsWeekly Downloads

    3

    Version

    0.0.2

    License

    GPL v2

    Last publish

    Collaborators

    • kvnneff
    • staygrimm