Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Meteor 流星启动返回函数_Meteor - Fatal编程技术网

Meteor 流星启动返回函数

Meteor 流星启动返回函数,meteor,Meteor,我已经多次看到Meteor的启动函数返回一个函数。这是什么意思?函数返回到哪里?谁在使用返回的函数 Meteor.startup(function () { Init(); return Tracker.autorun(function () { const userId = Meteor.userId(); if (!userId) { //do something } }); }); 我还没有看到startup返回函数,我也从

我已经多次看到Meteor的启动函数返回一个函数。这是什么意思?函数返回到哪里?谁在使用返回的函数

Meteor.startup(function () {  
  Init();

  return Tracker.autorun(function () {
    const userId = Meteor.userId();  

    if (!userId) {
        //do something
    }
  });
});

我还没有看到startup返回函数,我也从未使用过它。它不会坏,也会工作,但我不知道为什么在这个例子中会这样做

同样奇怪的是,它正在返回一个自动运行函数。。。启动和自动运行都是客户端api事件处理程序挂钩。。。任何人都不应该听函数调用的结果,因为这些调用不是由应用程序进行的,而是由meteor平台进行的,它们的功能是在启动时或作为单独的反应光纤(自动运行)运行代码