GitXplorerGitXplorer
h

react-native-meteor-minimongo-cache

public
41 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
f1325bfca42991616d13295d9f5fd3428a7d52be

First implementation and docs

hhharnisc committed 9 years ago
Unverified
76f122f8fc3d2f9f4709afc13386643cfdfef619

Initial commit

hhharnisc committed 9 years ago

README

The README file for this repository.

Quick Start

NOTE: this is an experiment, subject to change.

This works with the Meteor todos example project.

I'm using a pure JavaScript DDP client to talk to Meteor (via DDP).

However - instead of maintaining meteor collections with JavaScript objects it's using @petehunt's minimongo-cache to store them. This branch of DDPClient exposes minimongo-cache via collections

var ddpClient = new DDPClient({url: 'ws://127.0.0.1:3000/websocket'});

ddpClient.collections // minimongo-cache instance

Here's an example using minimongo-cache

var ddpClient = new DDPClient({url: 'ws://127.0.0.1:3000/websocket'});
var subComplete = () => {
  var todoItems = ddpClient.collections.observe(() => ddpClient.collections.lists.find({}));
  todoItems.subscribe((results) => this.updateRows(results));
}

ddpClient.connect(() => ddpClient.subscribe('publicLists', undefined, subComplete));

Here's the same functionality with the master branch of the node-ddp-client for reference

var ddpClient = new DDPClient({url: 'ws://127.0.0.1:3000/websocket'});

ddpClient.connect(() => ddpClient.subscribe('publicLists'));

// observe the lists collection
var observer = ddpClient.observe("lists");
observer.added = () => this.updateRows(_.cloneDeep(_.values(ddpClient.collections.lists)));
observer.changed = () => this.updateRows(_.cloneDeep(_.values(ddpClient.collections.lists)));
observer.removed = () => this.updateRows(_.cloneDeep(_.values(ddpClient.collections.lists)));

If you'd like to start playing around with the minimongo-cache branch of the DDPClient take a look at the package.json file. It's pointed at the latest commit of that branch.

Install NPM Modules

https://docs.npmjs.com/getting-started/installing-node

$ npm install

Screen Shot