32.8 ADD_LIBRARY Procedure
This procedure adds the script tag to load a JavaScript library. If a library has been added, it is not added a second time.
Syntax
APEX_JAVASCRIPT.ADD_LIBRARY (
    p_name                    IN VARCHAR2,
    p_directory               IN VARCHAR2,
    p_version                 IN VARCHAR2 DEFAULT NULL,
    p_check_to_add_minified   IN BOOLEAN  DEFAULT FALSE,
    p_skip_extension          IN BOOLEAN  DEFAULT FALSE,
    p_ie_condition            IN VARCHAR2 DEFAULT NULL,
    p_requirejs_module        IN VARCHAR2 DEFAULT NULL,
    p_requirejs_js_expression IN VARCHAR2 DEFAULT NULL,
    p_requirejs_required      IN BOOLEAN  DEFAULT FALSE,
    p_is_module               IN BOOLEAN  DEFAULT FALSE,
    p_is_async                IN BOOLEAN  DEFAULT FALSE,
    p_is_defer                IN BOOLEAN  DEFAULT FALSE,
    p_attributes              IN VARCHAR2 DEFAILT NULL,
    p_key                     IN VARCHAR2 DEFAULT NULL )Parameters
Table 32-7 ADD_LIBRARY Parameters
| Parameter | Description | 
|---|---|
| p_name | Name of the JavaScript file. Must not use .jswhen specifying. | 
| p_directory | Directory where JavaScript library is loaded. Must have a trailing slash. | 
| p_version | Version identifier. | 
| p_check_to_add_minified | If TRUE, the procedure tests if it is appropriate to add .minextension and add it if appropriate. This is added if an application is not running in DEBUG mode, and omitted when in DEBUG mode. | 
| p_skip_extension | If TRUE, the extension .jsis NOT added. | 
| p_ie_condition | Condition which is used as Internet Explorer condition. | 
| p_requirejs_module | Module name which is used to expose the library to RequireJS. | 
| p_requirejs_js_expression | JavaScript expression which is used to expose the library to the RequireJS module. | 
| p_requirejs_required | This has to be true if the library uses RequireJS in its code to loading other JavaScript files. | 
| p_key | Name used to indicate if the library has already been loaded. If not specified, defaults to p_directory||p_name||p_version. | 
| p_key | Name used to indicate if the library has already been loaded. If not specified, defaults to p_directory||p_name||p_version. | 
| p_key | Name used to indicate if the library has already been loaded. If not specified, defaults to p_directory||p_name||p_version. | 
| p_is_module | If true, adds type="module"to the script tag. | 
| p_is_async | If true, adds attribute asyncto the script tag. | 
| p_is_defer | If true adds attribute  
 
 | 
| p_attributes | Extra attributes to add to the script tag. Note:Callers are responsible for escaping this parameter. | 
| p_key | Name used to indicate if the library has already been loaded. If not specified, defaults to p_directory||p_name||p_version. | 
Example
The following example includes the JavaScript library file named hammer-2.0.4.min.js (if the application  has not been started from the Builder), or hammer-2.0.4.js (if the application has been started from the Builder  or is running in DEBUG mode), from the directory specified by p_plugin.file_prefix. Since p_skip_extension is not specified, this defaults to .js. Also, since p_key is not specified, the key defaults to p_plugin.file_prefix||hammer-2.0.4. Hammer is a JavaScript library which exposes itself to RequireJS using hammerjs as module name.
                  
apex_javascript.add_library (
    p_name                    => 'hammer-2.0.4#MIN#',
    p_directory               => p_plugin.file_prefix,
    p_requirejs_module        => 'hammerjs',
    p_requirejs_js_expression => 'Hammer' );Parent topic: APEX_JAVASCRIPT