jQuery.sap.require 如何工作? [英] How does jQuery.sap.require work?

查看:29
本文介绍了jQuery.sap.require 如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次调用 jQuery.sap.require("someLibrary") 时,SAPUI5 是否加载库?例如,如果我在应用程序的多个模块中调用上述语句,someLibrary"是否也被多次加载?

Does SAPUI5 load the libraries each time I call jQuery.sap.require("someLibrary")? For instance if I am calling the above statement in multiple modules in my application, is "someLibrary" loaded multiple times also?

推荐答案

lib 只加载一次.您可以在 SDK 中找到此信息https://sapui5.hana.ondemand.com/sdk/#docs/guide/ModularizationConcept.html

The lib is only loaded once. You can find this information in the SDK https://sapui5.hana.ondemand.com/sdk/#docs/guide/ModularizationConcept.html

模块加载

如前所述,模块是通过调用函数 jQuery.sap.require 和所需模块的名称来加载的.框架然后检查命名模块是否已经加载.如果是这样,该函数只是返回.否则,它会尝试同步加载和执行模块.如果这两个步骤中的任何一个失败,就会抛出异常,从而中断调用模块的执行.

As mentioned already, modules are loaded by calling function jQuery.sap.require with the name of a required module. The framework then checks whether the named module is loaded already. If so, the function simply returns. Otherwise it tries to load and execute the module synchronously. If any of these two steps fails, an exception is thrown and execution of the calling module thereby is disrupted.

这篇关于jQuery.sap.require 如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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