本文整理汇总了TypeScript中collections/links.Links类的典型用法代码示例。如果您正苦于以下问题:TypeScript Links类的具体用法?TypeScript Links怎么用?TypeScript Links使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Links类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: search
search(value: string) {
if (value) {
this.links = Links.find({ url: value });
} else {
this.links = Links.find();
}
}
示例2: saveLink
saveLink(link) {
if (Meteor.userId()) {
Links.update(link._id, {
$set: {
url: link.url
}
});
} else {
alert('Please log in to change this link');
}
}
示例3: function
Meteor.publish('link', function (linkId: string) {
return Links.find(buildQuery.call(this, linkId));
});
示例4: removeLink
removeLink(link) {
Links.remove(link._id);
}
示例5:
this.subscribe('links', () => {
this.links = Links.find();
}, true);
示例6:
this.subscribe('link', linkId, () => {
this.link = Links.findOne(linkId);
}, true);
示例7: loadLinks
export function loadLinks() {
if (Links.find().count() === 0) {
var links = [
{
"url" : "https://soundcloud.com/shigoosh/hey-baby-stephen-marley-feat-tupac-mos-def",
"nbClick" : 0,
'public': true
},
{
"url" : "http://www.youtube.com/watch?v=W4ATOCCyB2w",
"nbClick" : 3,
'public': true
},
{
"url" : "http://www.dailymotion.com/video/xryxme_sofiane-dingue-de-toi-nabi-nabila-clip-officiel_music",
"nbClick" : 2,
'public': true
},
{
"url" : "https://soundcloud.com/elliegoulding/tessellate-alt-j-cover",
"nbClick" : 5,
'public': true
},
{
"url" : "https://soundcloud.com/slowmagic/moon",
"nbClick" : 6,
'public': true
},
{
"url" : "https://www.youtube.com/watch?v=l_E9g4DVbRM",
"nbClick" : 0,
'public': true
},
{
"url" : "http://www.youtube.com/watch?v=KDBfkgcDwAI",
"nbClick" : 2,
'public': true
},
{
"url" : "http://www.youtube.com/watch?v=o2b2Xh4yFAs",
"nbClick" : 1,
'public': true
},
{
"url" : "http://www.youtube.com/watch?v=bpOSxM0rNPM",
"nbClick" : 3,
'public': true
},
{
"url" : "https://soundcloud.com/edbangerrecords/sebastian-h-a-l",
"nbClick" : 0,
'public': true
},
{
"url" : "https://www.youtube.com/watch?v=Sfou7a-nYEE",
"nbClick" : 1,
'public': true
}
];
for (var i = 0; i < links.length; i++) {
Links.insert(links[i]);
}
}
};