如何在运行时查找有关已加载的d3.js扩展及其版本的信息? [英] How to find out about loaded d3.js extensions and their versions at runtime?

查看:238
本文介绍了如何在运行时查找有关已加载的d3.js扩展及其版本的信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照JavaScript库的惯例,由 d3.js 提供的全局根对象具有自我识别属性它返回(并因此在控制台中调用时输出)所用库的版本.在这种情况下,是

As is customary with JavaScript libraries, the global root object supplied by d3.js has a self-identification attribute that returns (and thus, outputs, when called in the console) the version of the used library. In this case, it is

d3.version

现在,从4.0版开始,d3.js是模块化的因为在核心功能之上构建的大量功能被放置在单独的库中,这些库具有各自的发布周期.

Now, since version 4.0, d3.js is modular in that plenty of functionality built on top of the core features are placed in separate libraries, which have their own release cycles.

现在,我想知道是否还能找到诸如

Now, I'm wondering whether I can also find out the version of, say, an extension such as d3-selection-multi that is currently loaded in my JavaScript environment. Is there a separate root object for every such extension with a version field of its own, or is that information (preferrably even a list of all loaded extensions?) provided somewhere in the d3 root object?

推荐答案

否,无法在运行时检测模块的版本. D3的模块不会像捆绑包那样公开version属性,捆绑包也不包含有关所包含模块的任何信息.

No, there is no way of detecting a module's version at runtime. D3's modules do not expose a version property like the bundle does nor does the bundle include any information about the included modules.

这篇关于如何在运行时查找有关已加载的d3.js扩展及其版本的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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