meteor

onBefore event on react-router

你离开我真会死。 提交于 2021-01-29 04:19:22
问题 Can I call Meteor method before react-router redirect me to a page? I would like to make a history of the logged-in user about his/her page views. I see that in iron-router I can use onBeforeAction: function () {} I cant find similar event handler for react-router of ReactTraining. I am searching in their docs, https://github.com/ReactTraining/react-router/tree/1.0.x/docs In meteor server side, I am using simple:json-routes. I searched also their docs and can't find anything related to

Meteor WebApp middleware: passing params

南笙酒味 提交于 2021-01-29 01:39:51
问题 I would like to know how to pass parameters when using the official webapp package to listen to incoming HTTP requests on a particular route. Here is an example code: WebApp.connectHandlers.use("/hello/:myParam", function(req, res, next) { res.writeHead(200); res.end("Your param is", req.myParam); }); The above Express-like example does not work with WebApp. After some experiments, I now know I can access query params using req.query . But does WebApp allow you to access regular parameters?

Meteor WebApp middleware: passing params

早过忘川 提交于 2021-01-29 01:37:15
问题 I would like to know how to pass parameters when using the official webapp package to listen to incoming HTTP requests on a particular route. Here is an example code: WebApp.connectHandlers.use("/hello/:myParam", function(req, res, next) { res.writeHead(200); res.end("Your param is", req.myParam); }); The above Express-like example does not work with WebApp. After some experiments, I now know I can access query params using req.query . But does WebApp allow you to access regular parameters?

TypeError: Chartist.plugins.legend is not a function

こ雲淡風輕ζ 提交于 2021-01-28 21:30:30
问题 I'm have recently started use Meteor build tool with Chartist to represent my data. I have java script for legend template (source from internet) Template.js function drawBarChart() { new Chartist.Bar('.legendChart1', { labels: ['First quarter of the year', 'Second quarter of the year', 'Third quarter of the year', 'Fourth quarter of the year'], series: [ { "name": "Money A", "data": [60000, 40000, 80000, 70000] }, { "name": "Money B", "data": [40000, 30000, 70000, 65000] } ] }, { plugins: [

Meteor.js onRendered not triggered for dynamic template on data change

前提是你 提交于 2021-01-28 21:28:32
问题 I'm trying to integrate a dynamic template called "page-event" on "page-main" which depends on data from a helper: HTML MAIN {{>Template.dynamic template="page-event" data=selectedEvent}} JS MAIN Template["page-main"].helpers({ selectedEvent: function() { var eventId = Template.instance().selectedEventId.get() event = Collections.Events.findOne(eventId); return { event: event }; } }); JS EVENT Template["page-event"].onRendered(function() { const ti = this; var eventData = this.data.event;

mocha “describe” is not defined

人走茶凉 提交于 2021-01-28 08:21:01
问题 I read all the related mocha "describe" is not defined posts but none of them seem to be suitable for my situation. I use meteor and installed the "mocha": "^3.5.0" package by npm I have created a /test folder in my meteor root directory. and a sample test mochatest.js var assert = require("assert"); // node.js core module describe('Array', function(){ describe('#indexOf()', function(){ it('should return -1 when the value is not present', function(){ assert.equal(-1, [1,2,3].indexOf(4)); // 4

logout a meteor user on window/tab close but not on page refresh.

余生颓废 提交于 2021-01-28 07:40:35
问题 I have used window.onbeforeunload to logout a meteor user on browser tab close. It works fine with tab close but my user gets log out on page refresh which I do not want. Is there any solution to this problem. I want user to not logout on page refresh. I am new in Meteor. Any help would be highly appreciated. The code I have used for this is window.onbeforeunload = function() { Meteor.logout(); } 回答1: I'm kinda new to meteor too and after many tries I found this solution : if (sessionStorage

{{#if currentUser}} with icon inside still rendered when user logs out

十年热恋 提交于 2021-01-27 19:52:37
问题 Thank you for reading my message, here is my problem : I'm using a navbar made with Bulma in which I display either login/register buttons or a profile picture icon from FontAwesome using {{#if currentUser}} as shown below ("S'inscrire" and "Se connecter" means register and login in French) : <div class="navbar-end"> <div class="navbar-item"> <div class="buttons"> {{#if currentUser}} <!-- Displayed only when the user is logged in--> <i class="fas fa-user icon is-large" id="userProfile"></i> {

Installing Cordova plugin to meteor project using a github tarball link

送分小仙女□ 提交于 2021-01-27 16:44:20
问题 I'm trying to install a package to my meteor project using a repository in github. The only way Meteor allow me to install it is using a "tarball" specific link like this: https://github.com/Wizcorp/phonegap-facebook-plugin/tarball/d8b0f6935a7c6e586188bf85f9da88a1c160790b Although, the package version referenced in the link is not the one I need (I got that link from an old support post). Could someone explain me how to obtain that type of link (tarball) from this repository and version (0.12

Uncaught Error: Target container is not a DOM element. (React webpage won't show anything)

房东的猫 提交于 2021-01-27 14:10:12
问题 I have been following the tutorial provided by Meteor but was unable to run the provided code properly. There is nothing displayed on the page after I start the application. What could be the problem? I'm using Meteor platform version 1.7. I have installed React dependencies using a command: meteor npm install --save react react-dom I'm also getting error in the browser console: Uncaught Error: Target container is not a DOM element. at invariant (modules.js?hash