当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript meteor.Meteor类代码示例

本文整理汇总了TypeScript中meteor/meteor.Meteor的典型用法代码示例。如果您正苦于以下问题:TypeScript Meteor类的具体用法?TypeScript Meteor怎么用?TypeScript Meteor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Meteor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

	insert: function(project: Object) {
		var user = Meteor.user();
		return !!user;
	},
开发者ID:twastvedt,项目名称:barbatus-typescript-bug-demo,代码行数:4,代码来源:Projects.ts

示例2: function

Meteor.methods({
  invite: function (partyId:string, userId:string) {
    check(partyId, String);
    check(userId, String);
 
    let party = Parties.findOne(partyId);
 
    if (!party)
      throw new Meteor.Error('404', 'No such party!');
 
    if (party.public)
      throw new Meteor.Error('400', 'That party is public. No need to invite people.');
 
    if (party.owner !== this.userId)
      throw new Meteor.Error('403', 'No permissions!');
 
    if (userId !== party.owner && (party.invited || []).indexOf(userId) == -1) {
      Parties.update(partyId, {$addToSet: {invited: userId}});
 
      let from = getContactEmail(Meteor.users.findOne(this.userId));
      let to = getContactEmail(Meteor.users.findOne(userId));
 
      if (Meteor.isServer && to) {
        Email.send({
          from: 'noreply@socially.com',
          to: to,
          replyTo: from || undefined,
          subject: 'PARTY: ' + party.name,
          text: `Hi, I just invited you to ${party.name} on Socially.
                        \n\nCome check it out: ${Meteor.absoluteUrl()}\n`
        });
      }
    }
  },
  reply: function(partyId: string, rsvp: string) {
    check(partyId, String);
    check(rsvp, String);

    if (!this.userId)
      throw new Meteor.Error('403', 'You must be logged-in to reply');
 
    if (['yes', 'no', 'maybe'].indexOf(rsvp) === -1)
      throw new Meteor.Error('400', 'Invalid RSVP');
 
    let party = Parties.findOne({ _id: partyId });
 
    if (!party)
      throw new Meteor.Error('404', 'No such party');
 
    if (party.owner === this.userId)
      throw new Meteor.Error('500', 'You are the owner!');
 
    if (!party.public && (!party.invited || party.invited.indexOf(this.userId) == -1))
      throw new Meteor.Error('403', 'No such party'); // its private, but let's not tell this to the user
 
    let rsvpIndex = party.rsvps ? party.rsvps.findIndex((rsvp) => rsvp.userId === this.userId) : -1;
 
    if (rsvpIndex !== -1) {
      // update existing rsvp entry
      if (Meteor.isServer) {
        // update the appropriate rsvp entry with $
        Parties.update(
          { _id: partyId, 'rsvps.userId': this.userId },
          { $set: { 'rsvps.$.response': rsvp } });
      } else {
        // minimongo doesn't yet support $ in modifier. as a temporary
        // workaround, make a modifier that uses an index. this is
        // safe on the client since there's only one thread.
        let modifier = { $set: {} };
        modifier.$set['rsvps.' + rsvpIndex + '.response'] = rsvp;
 
        Parties.update(partyId, modifier);
      }
    } else {
      // add new rsvp entry
      Parties.update(partyId,
        { $push: { rsvps: { userId: this.userId, response: rsvp } } });
    }
  }
});
开发者ID:ElijahWolfe,项目名称:socially,代码行数:80,代码来源:methods.ts

示例3: function

import {Meteor} from 'meteor/meteor';
import {GamificationGrid, GamificationRecords} from './collection';


Meteor.publish('gamification.records', function () {
    console.log('publishing records')
    return GamificationRecords.find({
        user_id: this.userId
    });
});

Meteor.publish('gamification.grid', function() {
    console.log('publishing grid')
    return GamificationGrid.find({
        user_id: this.userId
    });
});
开发者ID:kucharskimaciej,项目名称:bullet-journal,代码行数:17,代码来源:publish.ts

示例4: function

 update: function() {
   let user = Meteor.user();
   return !!user;
 },
开发者ID:albertvazquezm,项目名称:present,代码行数:4,代码来源:presents.ts

示例5: listenAndSyncPartnerCameraChanges

const listenAndSyncPartnerCameraChanges = function listenAndSyncPartnerCameraChanges(): void {
  const userCameraSettings = PVUserCameraSettings.findOne({userId: getPartnerId()}),
        isUserCollaborating = Meteor.user() && Meteor.user().hasSharingState(SharedState.SHARED) || Meteor.user() && Meteor.user().hasSharingState(SharedState.JOINED);
  if (!isUserCollaborating || !userCameraSettings) return; // guard
  updateCamera(userCameraSettings.cameraSettings, cb('Error calling PV.updateCamera()', 'Successfully called PV.updateCamera()'));
};
开发者ID:fullflavedave,项目名称:meteor-paraviewweb-blaze-ui,代码行数:6,代码来源:paraview_shared_session_controls.ts

示例6: function

import {SNTgroups} from '../../both/collections/snt';
import {Meteor} from 'meteor/meteor';

// Return all snt groups
Meteor.publish('snt_groups', function(){
  return SNTgroups.find();
});
开发者ID:gab3alm,项目名称:csun_nsls,代码行数:7,代码来源:snt_groups.ts

示例7: function

import {Parties} from '../collections/parties';
import {Meteor} from 'meteor/meteor';

Meteor.publish('uninvited', function(partyId: string) {
    let party = Parties.findOne(partyId);

    if (!party)
        throw new Meteor.Error('404', 'No such party!');

    return Meteor.users.find({
        _id: {
            $nin: party.invited || [],
            $ne: this.userId
        }
    });
});
开发者ID:RichardHwang886,项目名称:socially16,代码行数:16,代码来源:users.ts

示例8:

import { Meteor }     from 'meteor/meteor';
import { Quotes }     from '../collections/quotes';
import quotesData     from './quotes.data';

// Init Data if (Quotes) Collection is empty
Meteor.startup(() => {
  if (Quotes.find().count() == 0)
    quotesData.forEach(quote => Quotes.insert(quote) );
});
开发者ID:nebiljabari,项目名称:RESTberry_Pi,代码行数:9,代码来源:startup.ts

示例9: function

import { Meteor } from 'meteor/meteor';
import {Locales} from '../imports/api/locales';


Meteor.publish('locales', function () {


    return Locales.find({});


});

Meteor.methods({


    'locales.insert'(locale) {
        var self = this;
        Locales.insert(locale);
    },
    'locales.remove'(localeId) {

        Locales.remove(localeId);
    },
    'locales.update'(localeId, action) {
        
        Locales.update(localeId, action);
        
    },

开发者ID:admirkb,项目名称:ads,代码行数:28,代码来源:locales.ts


注:本文中的meteor/meteor.Meteor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。