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


TypeScript Meteor.absoluteUrl方法代码示例

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


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

示例1: function

  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`
        });
      }
    }
  },
开发者ID:ElijahWolfe,项目名称:socially,代码行数:33,代码来源:methods.ts

示例2: function

  invite: function (trackId:string, userId:string) {
    check(trackId, String);
    check(userId, String);

    let track = Tracks.collection.findOne(trackId);

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

    if (track.public)
      throw new Meteor.Error('400', 'That track is public. No need to invite people.');

    if (track.owner !== this.userId)
      throw new Meteor.Error('403', 'No permissions!');

    if (userId !== track.owner && (track.invited || []).indexOf(userId) == -1) {
      Tracks.collection.update(trackId, {$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@beetrut.com',
          to: to,
          replyTo: from || undefined,
          subject: 'TRACK: ' + track.name,
          text: `Hi, I just invited you to ${track.name} on Beetrut.
                        \n\nCome check it out: ${Meteor.absoluteUrl()}\n`
        });
      }
    }
  },
开发者ID:harishmaiya,项目名称:gundmi48-gadikatte58,代码行数:33,代码来源:tracks.methods.ts

示例3: function

  invite: function (user: Invitation) {
    // 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!');

      // Parties.update(partyId, {$addToSet: {invited: userId}});
      let token = Random.hexString( 16 );
      let message = {
        subject: "Invitation",
        text: `Hi, I just invited you to be an user in my brand new app!.
                        \n\nCome check it out: ${Meteor.absoluteUrl()}acceptinvitation/${token}\n`
      };

      Invitations.insert({
      // company: ['', Validators.required],
      company: user.company,
      name: user.name,
      last_name: user.last_name,
      email: user.email,
      role: user.role,
      phone: user.phone,
      address: user.address,
      city: user.city,
      state: user.state,
      postal_code: user.postal_code,
      token: token,
      invitation_date: user.invitation_date,
      message: message,
      invited_by: Meteor.userId
    });
      let _from = "your@e.mail";
      let to = user.email;
      
      // console.log(to, Meteor.isServer, user, token);
      if (Meteor.isServer && to) {
        Email.send({
          from: _from,
          to: to,
          replyTo: _from || undefined,
          subject: message.subject,
          text: message.text
        });
        // console.log(token);
      }
  },
开发者ID:p3140,项目名称:angular2-meteor-starter-kit,代码行数:55,代码来源:methods.ts

示例4:

 this.autorun(() => {
   const found = Images.findOne(imageId);
   if (found) {
     // XXX Make sure to use proper absolute url of an image
     // jalik:ufs sets an absolute path of a file (let's say localhost:3000)
     // Might be a problem when running an app in a different port (development)
     if (!Meteor.isCordova) {
       imageUrl = found.url;
     } else {
       const path = `ufs/${found.store}/${found._id}/${found.name}`;
       imageUrl = Meteor.absoluteUrl(path);
     }
   }
 }, true);
开发者ID:Tallyb,项目名称:meteor-angular2.0-socially,代码行数:14,代码来源:display-main-image.pipe.ts

示例5: DisplayImageFilter

function DisplayImageFilter(image) {
  if (!image) {
    return image;
  }

  // leave it as it is for the web view
  if (!Meteor.isCordova) {
    return image.url;
  }

  // create new path of an image
  const path = `ufs/${image.store}/${image._id}/${image.name}`;
  return Meteor.absoluteUrl(path);
}
开发者ID:AyushAnandChouksey,项目名称:meteor-angular-socially,代码行数:14,代码来源:displayImageFilter.ts

示例6: invite

export function invite(partyId, userId) {
  check(partyId, String);
  check(userId, String);

  if (!this.userId) {
    throw new Meteor.Error(400, 'You have to be logged in!');
  }

  const party = Parties.findOne(partyId);

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

  if (party.owner !== this.userId) {
    throw new Meteor.Error(404, 'No permissions!');
  }

  if (party.public) {
    throw new Meteor.Error(400, 'That party is public. No need to invite people.');
  }

  if (userId !== party.owner && ! _.contains(party.invited, userId)) {
    Parties.update(partyId, {
      $addToSet: {
        invited: userId
      }
    });

    const replyTo = getContactEmail(Meteor.users.findOne(this.userId));
    const to = getContactEmail(Meteor.users.findOne(userId));

    if (Meteor.isServer && to) {
      Email.send({
        to,
        replyTo,
        from: 'noreply@socially.com',
        subject: `PARTY: ${party.title}`,
        text: `
          Hey, I just invited you to ${party.title} on Socially.
          Come check it out: ${Meteor.absoluteUrl()}
        `
      });
    }
  }
}
开发者ID:AyushAnandChouksey,项目名称:meteor-angular-socially,代码行数:46,代码来源:methods.ts

示例7: _getServerURL

 private static _getServerURL():{result: string, fromMeteor: boolean} {
   let result = '';
   let configured = '';
   let fromMeteor = false;
   if (typeof __meteor_runtime_config__ === 'undefined') {
     console.warn(' __meteor_runtime_config__ is undefined')
   } else {
     if ( typeof __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL !== 'undefined')
       configured =  __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL;
   }
   try {
     result = Meteor.absoluteUrl();
     fromMeteor = true;
   } catch (e) {
     result = configured;
   }
   return {result, fromMeteor};
 }
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:18,代码来源:connect-service-meteor.ts

示例8: transform

  transform(party: Party) {
    if (!party) {
      return;
    }

    let imageUrl: string;
    let imageId: string = (party.images || [])[0];

    const found = Images.findOne(imageId);

    if (found) {
      if (!Meteor.isCordova) {
        imageUrl = found.url;
      } else {
        const path = `ufs/${found.store}/${found._id}/${found.name}`;
        imageUrl = Meteor.absoluteUrl(path);
      }
    }

    return imageUrl;
  }
开发者ID:SiddheshKhedekar,项目名称:meteor-angular2.0-socially,代码行数:21,代码来源:display-main-image.pipe.ts

示例9:

export let generateData = Promise.denodeify((cb) => {
  const testConnection = Meteor.connect(Meteor.absoluteUrl());
  testConnection.call('tasks', cb);
});
开发者ID:cloudzombie,项目名称:angular2-meteor,代码行数:4,代码来源:generate_data.ts

示例10:



// Covers https://github.com/meteor-typings/meteor/issues/20
Rooms.find().count(true);


// Covers https://github.com/meteor-typings/meteor/issues/21
if (Meteor.isTest) {
    // do something
}

DDPRateLimiter.addRule({ userId: 'foo' }, 5, 1000);

DDPRateLimiter.addRule({ userId: userId => userId == 'foo' }, 5, 1000);

Template.instance().autorun(() => { }).stop();

// Mongo Collection without connection (local collection)
const collectionWithoutConnection = new Mongo.Collection<MonkeyDAO>("monkey", {
    connection: null
});

}  // End of namespace

// absoluteUrl
Meteor.absoluteUrl('/sub', {rootUrl: 'http://wonderful.com'});
Meteor.absoluteUrl.defaultOptions = {
  rootUrl: 'http://123.com',
  secure: false
};
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:28,代码来源:meteor-tests.ts


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