本文整理汇总了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`
});
}
}
},
示例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`
});
}
}
},
示例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);
}
},
示例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);
示例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);
}
示例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()}
`
});
}
}
}
示例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};
}
示例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;
}
示例9:
export let generateData = Promise.denodeify((cb) => {
const testConnection = Meteor.connect(Meteor.absoluteUrl());
testConnection.call('tasks', cb);
});
示例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
};