當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。