Vulcan/packages/example-customization/lib/callbacks.js

15 lines
377 B
JavaScript
Raw Normal View History

/*
Let's add a callback to the new post method that
appends a random emoji to the newly submitted post's title.
*/
2017-03-23 16:27:59 +09:00
import { addCallback } from 'meteor/vulcan:core';
2016-08-08 11:18:21 +09:00
function PostsNewAddRandomEmoji (post, user) {
post.title = post.title + " " +_.sample(["🎉", "💎", "☠", "⏱", "🎈", "⛱"])
return post;
}
addCallback("posts.new.sync", PostsNewAddRandomEmoji);