How to use the meteor/meteor.Meteor.subscribe function in meteor

To help you get started, we’ve selected a few meteor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lacymorrow / cinematic / imports / startup / client / database.js View on Github external
import {Meteor} from 'meteor/meteor'
import {Mongo} from 'meteor/mongo'

// Observe db collection changes
Meteor.subscribe('state')
Meteor.subscribe('genres') // A map of genre-firendly-name to genre id
Meteor.subscribe('movies')
Meteor.subscribe('movieCache')
Meteor.subscribe('recent') // Recently clicked
Meteor.subscribe('watched')

const State = new Mongo.Collection('state')
const Recent = new Mongo.Collection('recent')
const Watched = new Mongo.Collection('watched')
const Movies = new Mongo.Collection('movies')
const Genres = new Mongo.Collection('genres')

// State
export const getState = () => State.findOne({_id: '0'})

export const getGenres = () => Genres.find({items: {$exists: true}}, {sort: {name: 1}}).fetch()

export const getGenreById = gid => Genres.findOne(gid)
github mozilla / MozDef / meteor / client / investigations.js View on Github external
Deps.autorun( function() {
            Meteor.subscribe( "investigation-details", Session.get( 'investigationID' ), onReady = function() {
                initDatePickers();
            } );
            Meteor.subscribe( "userActivity", onReady = function() {
                //register a callback for new user activity
                //to show a notify when someone enters
                //screens the user is on
                //only run onReady to avoid initialization 'add' messages.
                cursorUserActivity = userActivity.find( {
                    path: 'investigation',
                    itemId: Session.get( 'investigationID' ),
                    userId: { $ne: Meteor.user().profile.email }
                },
                    {
                        reactive: true
                    } )
                    .observeChanges(
                        {
                            added: function( id, fields ) {
                                //console.log(fields);
github SparkEdUAB / SparkEd / imports / ui / components / Dashboard / DisplayResource.jsx View on Github external
export default withTracker(() => {
  Meteor.subscribe('resources');
  Meteor.subscribe('courses');
  Meteor.subscribe('filedetails');
  Meteor.subscribe('references');
  return {
    resources: References.find({ courseId: getCourseId() }).fetch(),
    resource: References.findOne({ _id: getResourceId() }),
    courseName: _Courses.findOne(
      { _id: getCourseId() },
      { fields: { name: 1 } },
    ),
  };
})(DisplayResource);
github openpowerquality / opq / view / app / imports / ui / components / IncidentInspector / IncidentViewer.jsx View on Github external
export default withTracker((props) => {
  const locationsSub = Meteor.subscribe(Locations.getCollectionName());
  const opqBoxesSub = Meteor.subscribe(OpqBoxes.getPublicationName());
  const opqBoxes = OpqBoxes.find().fetch();

  return {
    ready: opqBoxesSub.ready() && locationsSub.ready(),
    incident_id: Number(props.match.params.incident_id),
    opqBoxes,
    locations: Locations.find().fetch(),
  };
})(IncidentViewer);
github forbole / big_dipper / imports / ui / voting-power / ThirtyFourContainer.js View on Github external
export default ThirtyFourContainer = withTracker((props) => {
    const chartHandle = Meteor.subscribe('vpDistribution.latest');
    const loading = !chartHandle.ready();
    const stats = VPDistributions.findOne({});
    const statsExist = !loading && !!stats;
    return {
        loading,
        statsExist,
        stats: statsExist ? stats : {}
    };
})(ThirtyFour);
github catsass19 / Sapporo / imports / ui / admin / rank.jsx View on Github external
export default createContainer(() => {
    Meteor.subscribe('userData');
    Meteor.subscribe('problem');
    Meteor.subscribe('sapporo');
    Meteor.subscribe('language');
    return {
        _userData: userData.find({}).fetch(),
        _problem: problem.find({}).fetch(),
        _sapporo: sapporo.findOne({sapporo: true}),
        _language: language.find({}).fetch()
    };
}, Rank);
github thm-projects / arsnova-flashcards / imports / startup / client / routes.js View on Github external
subscriptions: function () {
		return [Meteor.subscribe('demoCardsets'), Meteor.subscribe('demoCards')];
	},
	data: function () {
github thm-projects / arsnova-flashcards / imports / startup / client / routes.js View on Github external
subscriptions: function () {
		return [Meteor.subscribe('repetitoriumCardsets'), Meteor.subscribe('paidCardsets'), Meteor.subscribe('userData')];
	},
	data: function () {
github openpowerquality / opq / view / app / imports / ui / components / EventInspector / EventSummary.jsx View on Github external
export default withTracker(() => {
  Meteor.subscribe(OpqBoxes.getPublicationName());
  return {
    calibration_constants: Object.assign(...OpqBoxes.find().fetch().map(box => (
      { [box.box_id]: box.calibration_constant }
    ))),
  };
})(EventSummary);
github erxes / erxes / imports / react-ui / insights / containers / TeamMembers.js View on Github external
function composer({ queryParams }, onData) {
  const insightHandle = Meteor.subscribe('insights.teamMembers', queryParams);
  const brandHandle = Meteor.subscribe('brands.list', 0);

  const brands = Brands.find({}, { sort: { name: 1 } }).fetch();

  if (brandHandle.ready() && insightHandle.ready()) {
    const mainData = MainGraph.find().fetch();
    const usersData = UsersData.find().fetch();

    onData(null, {
      mainData,
      usersData,
      brands,
    });
  }
}