meteor

What is cursor?

时光怂恿深爱的人放手 提交于 2020-01-03 05:19:22
问题 In discover meteor , posts: function() { return Posts.find(); } is used, not this: posts: function() { return Posts.find().fetch(); } I tried function below, it also works, and can realtime update. What is cursor exactly? And What is the different of above two functions? 回答1: The Meteor cursor is like a lazy version of the array of documents. It's designed to iterate through the results of a query while not actually loading each of the documents until they are actually requested or the cursor

File load order in Meteor

泄露秘密 提交于 2020-01-03 05:19:11
问题 I have defined some functions in server/methods.js which I use in some of my methods such as: function randomIntFromInterval(min, max) { return Math.floor(Math.random() * (max - min + 1) + min); } If I want to use the functions in my methods, I have to place them in server/methods.js . Why can't I place the functions in lib/utils.js ? I thought that files in lib/ would be called first, so functions there would be accessible in all other files. 回答1: By defining your function like this function

How to show another user's profile image item with Meteor Cloudinary

蓝咒 提交于 2020-01-03 05:07:09
问题 Theres 2 issues. Firstly : Once a room is started, theres 2 people in it, owner and receiver. I am unable to display the other person's profile image in the list of rooms. I can see my own image thats is uploaded via Cloudinary, saved under profile --> profilepicId as an Id which then generates an image. Secondly : I cannot retrieve posts of a user when I go to user's page. Server throws a id match error. Sometimes it also hangs and I will not be able to view my own posts when i go to my

how to add walls to a famo.us physics simulation?

别等时光非礼了梦想. 提交于 2020-01-03 05:06:06
问题 I have a simple physics sim with some bouncing balls. I'm trying to add a bounding box of "walls" but having problems. any examples would be great :) meantime looking at the cool ascii art docs here * (wall) * | * | (normal) (origin) * | ---> * * | * | (distance) * ................... * (100px) * * e.g., Wall({normal : [1,0,0], distance : 100}) my guess is that adding a wall of @walls.push = new Wall({normal : [1,0,0], distance : 5}) should be a wall of just 5 pixels left of the origin. my

Meteor : Accounts onCreateUser

微笑、不失礼 提交于 2020-01-03 04:54:11
问题 Accounts.onCreateUser(function(options,user){ if (options.password.length < 6 && options.password.length != 0) { throw new Meteor.Error(); } else if (options.password.length == 0) { throw new Meteor.Error(); } else { user.password = options.password; } }); Simple server-side validation. Here's my create user call: Accounts.createUser({email:email,username:username,password:password,profile:{firstname:firstname,lastname:lastname}},function(error){}); Without the server-side validation, it

Meteor: Changing a subtemplate without changing parent template

雨燕双飞 提交于 2020-01-03 04:23:08
问题 If I have the following template structure <template name="A"> {{> B}} {{> C}} </template> How can I have C update when it changes without having Template A re-render? I've tried {{#isolate}}{{> C}}{{/isolate}} but this doesn't work and using a constant region isn't quite right either as this isn't a constant region. 回答1: As of Meteor 0.7.0.1, re-rendering a sub-template causes the parent to re-render but not sibling templates. Isolate works the same way. I put together a simple example of

How to get rid of Meteor template flickers

柔情痞子 提交于 2020-01-03 04:21:14
问题 I have a Meteor template with multiple conditions, and I get a flicker of some of the conditional views when it loads initially. I'm using iron router and I'm aware of the subscriptions, wait() and ready() options, however one of the problems is that the main conditional isInstalled depends on a meteor.call callback to set the isInstalled variable, so the wait doesn't depend on a subscription. So how do I account for this use case? <template name="adminLayout"> {{#if isInstalled}} {{#if

How can i clean a local Collection in Meteor

一世执手 提交于 2020-01-03 04:10:06
问题 Normally you can only delete single records from a local Meteor.Collection . 回答1: A simple solution would be: var clean = function(collection) { if(collection) { // clean items _.each(collection.find().fetch(), function(item){ collection.remove({_id: item._id}); }); } } 来源: https://stackoverflow.com/questions/17072350/how-can-i-clean-a-local-collection-in-meteor

Meteor Up Deployment to Amazon EC (Ubuntu 14.04) not working

橙三吉。 提交于 2020-01-03 04:08:28
问题 I setup a standard Amazon Micro instance with Ubuntu 14.04, set a sudo user, and basically followed the instructions for Meteor Up. I get this error at the "Invoking deployment process" stage... -----------------------------------STDERR----------------------------------- Warning: Permanently added 'ec2-54-200-136-28.us-west-2.compute.amazonaws.com,54.200.136.28' (ECDSA) to the list of known hosts. npm http GET https://registry.npmjs.org/fibers npm http 304 https://registry.npmjs.org/fibers %

Mixing handlebars.js and CSS - Random background image?

ぃ、小莉子 提交于 2020-01-03 03:38:06
问题 I would like to set a randomly generated background image. I am using Meteor and am calling Flickr API to provide a random image URL which I would like to set as my background image. From what I've read, it seems that CSS is now the recommended way to set a background image. Is there a way to inject the dynamically generated url into the CSS? I can't seem to find examples showing mixing of Handlebars.js and CSS - is this possible? Or should I be avoiding CSS and setting the background image