Including other files

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with " Because the standard Javascript language does not have the notion of a script file we added some extensions to include a script file from another one. ===Syntax=== <pre> #i...")
 
(Limitations)
 
Line 23: Line 23:
 
'''See also'''
 
'''See also'''
 
* [[Javascript]]
 
* [[Javascript]]
 +
 +
[[Category:Javascript]] [[Category:Programmers]]

Latest revision as of 16:31, 31 October 2013

Because the standard Javascript language does not have the notion of a script file we added some extensions to include a script file from another one.

[edit] Syntax

#include "file1.js"
#require "file2.js"

IMPORTANT: There's no semicolon at end, these are not Javascript instructions.

The #require form prevents repeated inclusion of same file. This is the preferred form unless you have special requirements.

The #include form includes the specified file unconditionally.

[edit] Limitations

Since the inclusion is performed at parsing time the file name must be a string literal, it cannot be a variable.

File inclusion cannot occur inside an instruction or function.

See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers