requirejs 配置任意数据
在 Dojo 1.7 AMD Web 应用程序中,您还可以在配置对象中定义任意数据 (http://dojotoolkit.org/reference-guide/loader/amd.html)。
配置对象还可用于设置任意的、特定于应用程序的配置数据。配置对象的所有属性都浅复制到 require.rawConfig
我查看了 requirejs 配置页面(http://requirejs.org/docs/api.html#config),但我在这里没有找到类似的功能。但我没有查看源代码。
是否可以在 requirejs 配置中存储任意信息并访问它?
提前非常感谢
沃尔夫冈
In an Dojo 1.7 AMD web app you can define also arbitrary data in the config object (http://dojotoolkit.org/reference-guide/loader/amd.html).
The configuration object can also be used to set arbitrary, application-specific configuration data. All properties of a configuration object are shallow copied to require.rawConfig
I looked to the requirejs config page (http://requirejs.org/docs/api.html#config), but I did not find a similar feature here. But I did not look into the source code.
Is there a possibility to store arbitrary infos in the requirejs config and get access to it?
Thanks alot in advance
Wolfgang
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,它不受支持。
您需要在 require.js 源代码中插入 1 行才能获得此功能。
这是一个示例:
除了正常值之外,您还可以存储任意信息。
然后,你必须用文本编辑器打开requirejs源代码。
大约在第 380 - 390 行(取决于您的版本),函数“makeRequire”:
该函数调用另一个名为“mixin”的函数:
在“isBrowser”之后写入“rawConfig:config”。
现在,在您的 amd 模块中:
更新:
该功能将在 requirejs 1.1 中实现。
https://github.com/jrburke/requirejs/issues/182
As far as I can see it is not supported.
You need to insert 1 line in the require.js source code to get this feature.
Here is an example:
Along with the normal values you store your arbitrary information.
Then, you have to open the requirejs source code with a text editor.
Approximately in line 380 - 390 (depends on your version), function "makeRequire":
This function calls another called "mixin":
After "isBrowser" write "rawConfig: config".
Now, in your amd module:
Update:
This feature will be implimented in requirejs 1.1.
https://github.com/jrburke/requirejs/issues/182