javascript - When can I user Meteor.call synchronously? -


The documentation says

Finally, if you are inside the stub on the client and call Another method, the other method is not executed (no RPC is generated, nothing is "real"). If the other method has a stub, then the stub stands for the method and is executed. The return value of the method call is the return value of the value stub function. Client has no problem executing the stub with synchronous, and so it is okay to use the synchronous Meteor.call form from within a method body as described earlier in the client.

But I do not know what it means, what is a stub? How can I run it in a stub? Is an Event a Stub?

You can only use meteor.call synchronously on the server.

A 'stub' is a Meteor.methods that runs on the client side. Usually it runs on server side.

When it runs on the client, it does not really do anything, which is why it is a stub. It can be useful to simulate which can delay the effect of the compensation.

For example you

  Meteor.call ("create_something", function (err, result) {warning (result)});   

then on your server side

  Meteor.methods ({create_something: function () {SomeCollection.insert ({date: new date}}); }});   

So when you run Meteor.call , it will record a record on the server, if the client subscribes to the client, it will also get the result, but after some time - Due to delay between server and client

If you add the stub method to the cloud:

  Meteor.methods ({create_something: function () {SomeCollection.insert ({date: new date}}) }}});   

Now if you do this, then the client side will add this simulated-non-real record, until the server returns the result.

Its idea makes the UI more sensitive, and the Meteor.call is directly on the client as the SomeCollection.insert as instant (ui-wise) Make them.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -