Skip to content

baysao/riot-meteor-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RiotMeteorData

This mixin is a convenient way to use data from a Meteor reactive data source in a Riot component, with automatic updates when the data changes.

Demo

Code

##Usage

In common code add this

Riot.mixin('RiotMeteorData', RiotMeteorData);

In riot component add mixin set reactive data in

this.getMeteorData = function(){
  // preprare data here
  return {
  // object auto computation for reactive
  }
}

and add mixin right after this

this.mixin('RiotMeteorData');

this mixin run computation and update data in this.data property of component context. Read more about explain here

For example:

<todo>
  <h3>{ opts.title }</h3>
  <ul>
    <li each={ data.books }>
      <label>
           { author }
           { name }
      </label>

    </li>
  </ul>
  <script>
    this.getMeteorData = function() {
      return {
        books: Books.find().fetch()
      };
    }
    this.mixin('RiotMeteorData');
  </script>
</todo>

About

Riotjs Mixin help integrate with Meteor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published