Class Index | File Index

Classes


Class XataJax.util


Defined in: xatajax.util.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A class that includes utility methods that are needed for loading scripts and manipulating the environment.
Method Summary
Method Attributes Method Name and Description
<static>  
XataJax.util.getRequestParams(url)
Gets the query parameters for the current request.
<static>  
XataJax.util.getSiteHref()
Returns the full path to the script (including index.php).
<static>  
XataJax.util.getSiteURL()
Returns the URL to the site (not including the actual file).
<static>  
XataJax.util.loadScript(path, callback)
Dynamically loads a script by the script's path.
<static>  
XataJax.util.url(params)
Converts the specified query parameters into a URL with proper url encoding.
Class Detail
XataJax.util()
A class that includes utility methods that are needed for loading scripts and manipulating the environment.
Method Detail
<static> {Object} XataJax.util.getRequestParams(url)
Gets the query parameters for the current request.
Parameters:
url
Returns:
{Object} The key-value pairs of GET variables.

<static> {String} XataJax.util.getSiteHref()
Returns the full path to the script (including index.php). This is a wrapper for the DATAFACE_SITE_HREF variable that should be set in the template via PHP/Smarty.
Returns:
{String}

<static> {String} XataJax.util.getSiteURL()
Returns the URL to the site (not including the actual file). This is a wrapper for the DATAFACE_SITE_URL variable that should be set in the template using PHP/Smarty.
Returns:
{String} The base URL to the site.

<static> XataJax.util.loadScript(path, callback)
Dynamically loads a script by the script's path. Note that only scripts located in the Xataface Javascript include paths can be loaded with this method.
//require <xatajax.util.js>
var loadScript = XataJax.load('XataJax.util.loadScript');
loadScript('xataface/IO.js', function(){
    // Now IO.js should be loaded.
    var IO = XataJax.load('xataface.IO');
    IO.load('people?person_id=1', function(res){
        alert('First Name: '+res.first_name);
    });
});
Parameters:
{String} path
The path to the script to load. This should be the same format as the require directive takes.
{Function} callback
A callback function to be called after the script has been loaded.
See:
Dataface_JavascriptTool for information about javascript include paths and how to set them up.
The Xataface load_script action for information on how to manipulate the include path on a per request basis. In particular you may find it useful to implement a handler for the beforeLoadScript event (@see The registerEventListener() method in Dataface_Application

<static> {String} XataJax.util.url(params)
Converts the specified query parameters into a URL with proper url encoding.
Parameters:
{Object} params
Key-value pairs of GET parameters to include.
Returns:
{String} A URL

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Mar 30 2012 15:10:19 GMT-0700 (PDT)