api.imply是做什么的? [英] What does api.imply do?

查看:92
本文介绍了api.imply是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

流星文档:

此软件包的用户可以访问另一个软件包(通过传递字符串packagename)或软件包集合(通过传递字符串数组[packagename1, packagename2]).

Give users of this package access to another package (by passing in the string packagename) or a collection of packages (by passing in an array of strings [packagename1, packagename2]).

我不知道这是什么意思.
来自

I have no idea what it means.
From this question I know that imply can be employed with use.

api.imply的作用是什么?
api.useapi.imply之间到底有什么区别?

What does api.imply do?
What's exactly the difference between api.use and api.imply?

推荐答案

api.use使软件包可以访问其他软件包导出的符号.

api.use gives a package access to other packages exported symbols.

例如,您需要api.use("random")(查看如何完成如果您想在软件包代码中使用Random符号(

For example you need to api.use("random") (see how it's done in the accounts-base package) if you want to use the Random symbol in a package code (see how the random package.js is api.exporting Random).

但是,meteor add ing accounts-base不会让整个应用程序访问其使用过的软件包(在本例中为random).如果您的应用需要random,则仍然需要meteor add

However, meteor adding accounts-base wouldn't give your whole application access to its used packages (random in this case). If your app needs random, you'd still need to meteor add it.

api.imply允许整个应用程序访问该程序包导出的符号.

api.imply on the other hand, gives the whole application access to that package exported symbols.

例如,查看accounts-google的方式api.imply accounts-base .

For example, see how accounts-google is api.implying accounts-base.

accounts-base负责导出Accounts符号,当您meteor add accounts-google时,不仅会在应用程序依赖项中添加accounts-base,而且还会在应用程序中使用accounts-base符号,特别是因为它暗含了.

accounts-base is responsible for exporting the Accounts symbol, when you meteor add accounts-google, not only does accounts-base is also added in your application dependencies, but accounts-base symbols are also made available in your app, specifically because it was implied.

accounts-base都在自己的代码(api.use)中使用Accounts,并将其依赖项符号导出到整个应用程序(api.imply).

accounts-base is both using Accounts in its own code (api.use) and exporting its dependencies symbols to the whole app (api.imply).

api.imply可用于制作影子包",这些影子包仅在其他包中拉入.

api.imply can be used to make "shadow packages" that are just pulling in some other packages.

例如,在某个时候,MDG将showdown包重命名为markdown,他们本可以将其声明为meteor remove showdown && meteor add markdown,但这将需要对最终用户采取一些措施.

For example, at some point MDG renamed the showdown package to markdown, they could just have stated to meteor remove showdown && meteor add markdown, but it would have required some actions on end users.

他们所做的只是保留了showdown软件包,而只是暗示新的markdown程序包.

What they did instead is keeping the showdown package and just make it implying the new markdown package.

这篇关于api.imply是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆