jQuery.provide()
Categories: Core | Internationalisation | Templates
jQuery.provide( id, [ plugins ], function(jQuery) )Returns: Promise
Description: Provide a script.
-
jQuery.provide( id, [ plugins ], function(jQuery) )
version added: 1.0id A unique identifier for the script to provide.
plugins A plugin name or an array of plugin names that define requirements for this scipt.
function(jQuery) The script code to execute after all required plugins are ready. Receives jQuery as argument.
-
jQuery.provide( id, [ options ], function(jQuery) )
version added: 1.0id A unique identifier for the script to provide.
options A set of type/name(s) pairs that define requirements for this script.
function(jQuery) The script code to execute after all dependencies are ready. Receives jQuery as argument.
The jQuery.provide()
method is a part of the dependencies controler in jQuery SDK.
Dependencies controller:
jQuery SDK let you provide scripts for other scripts.
The received argument is jQuery, it is very useful if jQuery are running in noConflict mode.
So you can use the $
alias inside your plugin.
jQuery SDK file structure:
All plugins are located in the script directory and dots in plugin names represent subdirectories.
- jQuery.core is script/jQuery/core.js
- jQuery.ui.dialog is script/jQuery/ui/dialog.js
-
A simple provide without dependecies.
Code:
jQuery.provide( 'bar', function($){ // run your script code here });
-
A provide which requires 2 other plugins.
Code:
jQuery.provide( 'bar', ['jQuery.tmpl', 'jQuery.json'], function($){ // run your script code here });
-
A provide which requires 2 plugins and a provided scipt.
Code:
jQuery.provide( 'bar', { plugin: ['jQuery.tmpl', 'jQuery.dict'], script: 'foor' }, function($){ // run your script code here });
jQuery.provide( id, [ options ], function(jQuery) )Returns: Promise
Plugin: jQuery.dict
Description: Provide a script.
-
jQuery.provide( id, [ options ], function(jQuery) )
version added: 1.0id A unique identifier for the script to provide.
options A set of type/name(s) pairs that define requirements for this script.
function(jQuery) The script code to execute after all dependencies are ready. Receives jQuery as argument.
The jQuery.dict
plugin extends the dependencies controller. So it is possible to load dictionaries automatical with Ajax.
jQuery SDK file structure:
All dictionaries are JSON files located in the script directory and dots in dictionary names represent subdirectories. To specify the region, set the region before the dictionary name with colon separation, if no region specified the default region will be used.
- de:project.example is script/project/example.de.json
- en:project.example is script/project/example.en.json
- en-US:project.example is script/project/example.en-US.json
jQuery.provide( id, [ options ], function(jQuery) )Returns: Promise
Plugin: jQuery.i18n
Description: Provide a script.
-
jQuery.provide( id, [ options ], function(jQuery) )
version added: 1.0id A unique identifier for the script to provide.
options A set of type/name(s) pairs that define requirements for this script.
function(jQuery) The script code to execute after all dependencies are ready. Receives jQuery as argument.
The jQuery.i18n
plugin extends the dependencies controller. So it is possible to load internationalisation regions and
currencies automatical with Ajax.
jQuery SDK file structure:
All region and currency are Javascript files located in the script/jQuery/i18n directory.
Regions:
Each region is given a unique code that is a combination of an ISO 639 two-letter lowercase culture code for the language and a two-letter uppercase code for the country or region. There are exceptions for some regions, such as Latin and Cyril variant.
- en is script/jQuery/i18n/en.js
- en-US is script/jQuery/i18n/en-US.js
- de is script/jQuery/i18n/de.js
- de-DE is script/jQuery/i18n/de-DE.js
- de-AT is script/jQuery/i18n/de-AT.js
Currencies:
Each currency is given a unique code of an ISO 4217 three-letter uppercase code.
- USD is script/jQuery/i18n/USD.js
- EUR is script/jQuery/i18n/EUR.js
jQuery.provide( id, [ options ], function(jQuery) )Returns: Promise
Plugin: jQuery.tmpl
Description: Provide a script.
-
jQuery.provide( id, [ options ], function(jQuery) )
version added: 1.0id A unique identifier for the script to provide.
options A set of type/name(s) pairs that define requirements for this script.
function(jQuery) The script code to execute after all dependencies are ready. Receives jQuery as argument.
The jQuery.tmpl
plugin extends the dependencies controller. So it is possible to load templates automatical with Ajax.
jQuery SDK file structure:
All templates are HTML files located in the script directory and dots in dictionary names represent subdirectories.
- project.example is script/project/example.tmpl.html
- project.advanced is script/project/advanced.tmpl.html