Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List Meteor methods registered with Meteor.methods()?

Tags:

meteor

Wondering if there was a way to get a list of the current Meteor.methods that have been registered.

for example if a post method is registered like so:

Meteor.methods({
  post: function() {
    //code
  }
});

Is there a way to access a list of these methods? Ideally it would be via a method but if it was stored in an accessible variable like Meteor.__methods that would work as well.

I've combed through the documentation and the Meteor global in the browser but did no find anything useful. Any Ideas?

like image 660
Kelly Copley Avatar asked Jun 20 '13 21:06

Kelly Copley


People also ask

What is Meteor methods?

Meteor methods are functions that are written on the server side, but can be called from the client side. On the server side, we will create two simple methods. The first one will add 5 to our argument, while the second one will add 10.

What is Meteor call?

Meteor. call() is typically used to call server-side methods from the client-side. However, you can also use Meteor. call() on the server-side to call another server-side function, though this is not recommended.


1 Answers

On the client you can do:

Meteor.connection._methodHandlers

It gives you a dictionary of function names to functions.

like image 196
bert Avatar answered Oct 20 '22 01:10

bert