gpt4 book ai didi

javascript - Meteor 方法回调何时触发?

转载 作者:行者123 更新时间:2023-12-03 08:09:27 26 4
gpt4 key购买 nike

我的问题非常简单:给定一个在服务器和客户端上加载的 Meteor 方法,如果您在客户端上/从客户端调用此方法并提供回调,那么此回调何时触发?

  1. 前端模拟什么时候完成?
  2. 后端前端调用何时完成?

Meteor docs只是说:

Meteor tracks the database updates performed as part of a method call, and waits to invoke the client-side callback until all of those updates have been sent to the client.

这个恕我直言并没有明确它是在等待服务器端更新还是客户端模拟更新。如果它总是等待服务器端,那么这基本上会破坏此时的“延迟补偿”,因为您无法在客户端上/从客户端调用除异步样式之外的方法,因为您没有纤程。

最佳答案

伙计,这方面的语言再困惑不过了。我相信它只会在服务器完成后被调用一次。

来自 Meteor 文档。

Meteor tracks the database writes performed by methods, both on the client and the server, and does not invoke asyncCallback until all of the server's writes replace the stub's writes in the local cache. In some cases, there can be a lag between the method's return value being available and the writes being visible

希望这有帮助!

关于javascript - Meteor 方法回调何时触发?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34205045/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com