How can I export from a Meteor package into my app's namespace?

后端 未结 3 515
渐次进展
渐次进展 2021-02-05 21:25

I know how to write Meteor packages but I can\'t seem to figure out how to have all exports land in my app\'s namespace, as described in this presentation.

This particul

3条回答
  •  时光取名叫无心
    2021-02-05 21:46

    In your package, you should define all methods and symbols in the namespace you want them to have, and then export that namespace. So, if in your package you've got:

    MyApp = {
       myMethod: ...
    };
    

    Then you export it with api.export('MyApp').

    Unfortunately, there's no method similar to the one in Node you've mentioned, as all packages are loaded globally on startup.

提交回复
热议问题