Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

meteor-ditto

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meteor-ditto

A framework to work with Redux in a Meteor application

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

WIP METEOR-DITTO

I'm still working on it

This package contains an opinionated set of helpers to use with Redux on a Meteor application.

The pokemon named Ditto

The name for this package comes from me playing too much Pokemon Go and this package's weakness being the duplication of data

Concept

Install

First install the package:

npm install --save meteor-ditto

Next setup the reducers.

import { mongo } from 'meteor-ditto';

const reducers = combineReducers({
  mongo,
  (your other reducers)
});

Finally, connect the collections:

import { connect as connectCollection } from 'meteor-ditto';

// Messages is an example of a Meteor collection
connectCollection(Messages, store)

Usage

Subscribing to publications

When you use SubscriptionComponent to compose your component, two functions will be sent through the props: subscribe and subscriptionReady. The first should be called inside a componentWillMount with the name of the publications and it's arguments, the same way you would call Meteor.subscribe(..). The second accepts the name of a publication and sees if it's ready or not.

import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { SubscriptionComponent } from 'meteor-ditto';

class App extends Component {
  componentWillMount() {
    this.props.subscribe('messages', arg1, arg2);
  }

  render {
    return (
      <SomeComponent
        {...this.props}
        ready={this.subscriptionReady('messages')}
      />
    );
  }
}

App.propTypes = {
  subscribe: PropTypes.func.isRequired,
  subscriptionReady: PropTypes.func.isRequired,
};

export default connect(fn => fn)(SubscriptionComponent(App));

Read from the store

FAQs

Package last updated on 20 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc