Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/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
Javascript 如何在meteor应用程序中使用jsdoc_Javascript_Meteor_Documentation_Jsdoc - Fatal编程技术网

Javascript 如何在meteor应用程序中使用jsdoc

Javascript 如何在meteor应用程序中使用jsdoc,javascript,meteor,documentation,jsdoc,Javascript,Meteor,Documentation,Jsdoc,在meteor应用程序中使用JSDoc的正确方法是什么? 下面是我记录代码的方法,但在所有部分之间没有“连接”。 所有内容都属于示例模板,因此jsdoc的输出应该正确构造 如何改进此文档 Template.example.helpers({ /** * Get all categories * @name categories * @return {Cursor} * @summary Cursor categori

在meteor应用程序中使用JSDoc的正确方法是什么? 下面是我记录代码的方法,但在所有部分之间没有“连接”。 所有内容都属于示例模板,因此jsdoc的输出应该正确构造

如何改进此文档

Template.example.helpers({
    /**
     * Get all categories
     * @name        categories
     * @return      {Cursor}
     * @summary     Cursor categories
     */
    categories() {
        return Categories.find({});
    },
});

Template.example.onCreated(
    /**
     * If template is created (still not rendered), ReactiveDict variable is initialized
     * @function
     * @name        onCreated
     * @summary     Set ReactiveDict
     */
    function() {
        this.something = new ReactiveDict();
    }
);

Template.example.events({
    /**
     * Clicking on category will show a console message
     * @event
     * @summary     Console message
     */
    'click #category': (event, template) => {
        console.log('nice')
    }
});

在我工作的地方,几个月前我们遇到了同样的情况,我们得出的结论是
jsdoc
不适合使用
Meteor
实现的自动文档。我们最终使用了能让我们完全满意的产品。 它基本上使用meteor特定的关键字扩展了
jsdoc
语法,因此您可以指定什么是
meteor.call
,什么是集合助手等等。一旦配置并运行,输出基本上就是Meteor的文档在1.3之前的样子(正如作者所说,它“基于Meteor自己文档中的模板”)

编辑:由于我们没有使用Meteor的模板系统,我没有一个现有的示例,但我根据您的案例改编了一个集合助手,如果有任何不清楚的地方,请告诉我。诀窍是根据您希望文档的显示方式,使用
@memberOf
@isMethod

   /**
     * @memberOf Foo Template
     * @summary Returns Bar conversation attached to stuff
     * @param {String} fooId
     * @param {Boolean} forced # Use to create foo when it's not found
     * @returns {Object} Bar
     */
    getStuff: function(fooId, forced=false) {
            'use strict';
           /** your code **/
    }

你能给我一个示例代码吗?我不知道应该使用什么
isTemplate
以及如何标记
事件
。@ko0stik meteor jsdoc已被弃用,我不确定它是否支持react。你能分享一下你是否找到了其他解决方案吗?@cenk不幸的是,我停止使用Meteor,所以在这件事上我帮不了你多少忙。