本文整理匯總了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]);
}
}
};