在露天的另一个 javascript 文件中包含 .js 文件
Include .js file in another javascript file in alfresco
我在户外工作,想知道如何在另一个文件中包含一个 js 文件。想使用库时如何处理依赖?
非常感谢
按照 Lista 的建议,我创建了一个答案:
我想这就是你需要的(来自Alfresco documentation):
Importing scripts
This feature allows you to build libraries of scripts for use by other
scripts at runtime. The syntax to import the scripts is specific to
Alfresco and is not a feature of standard JavaScript. For example, the
syntax, as supported by most web browsers, is not
part of standard ECMA JavaScript and will not work in Alfresco.
The syntax to import other scripts is very strict and you must follow
it exactly; otherwise, the import may fail. Import directives must be
the first lines in the JavaScript file. This means that no code or
comments are allowed above those lines, and the usual JavaScript code
and comments appear after the import lines. Only the following syntax
variants are supported:
Import a script from the repository using a name-based path:
<import resource="/Company Home/Data Dictionary/Scripts/library.js">
Import a script from the repository using a NodeRef reference:
<import resource="workspace://SpacesStore/6f73de1b-d3b4-11db-80cb-112e6c2ea048">
Import a script from a Java classpath location:
<import resource="classpath:alfresco/extension/myutils.js">
我在户外工作,想知道如何在另一个文件中包含一个 js 文件。想使用库时如何处理依赖?
非常感谢
按照 Lista 的建议,我创建了一个答案:
我想这就是你需要的(来自Alfresco documentation):
Importing scripts
This feature allows you to build libraries of scripts for use by other scripts at runtime. The syntax to import the scripts is specific to Alfresco and is not a feature of standard JavaScript. For example, the syntax, as supported by most web browsers, is not part of standard ECMA JavaScript and will not work in Alfresco.
The syntax to import other scripts is very strict and you must follow it exactly; otherwise, the import may fail. Import directives must be the first lines in the JavaScript file. This means that no code or comments are allowed above those lines, and the usual JavaScript code and comments appear after the import lines. Only the following syntax variants are supported:
Import a script from the repository using a name-based path:
<import resource="/Company Home/Data Dictionary/Scripts/library.js">
Import a script from the repository using a NodeRef reference:
<import resource="workspace://SpacesStore/6f73de1b-d3b4-11db-80cb-112e6c2ea048">
Import a script from a Java classpath location:
<import resource="classpath:alfresco/extension/myutils.js">