Appspresso
Contact us   |
  • English
  • ABOUT
    • Overview
    • License
    • Roadmap
  • SHOWCASE
    • Featured Apps
    • Appspresso Features
    • Show off your app
  • DOWNLOAD
    • Download Appspresso
    • 3rd party libraries & frameworks
  • DEVELOPER CENTER
    • Getting Started
    • Tutorials
    • API Reference
    • API Samples
    • Appspresso Plug-in Development Kit
    • Google Groups

Namespace ax.util

utility functions for appspresso javascript API.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
ax.util
utility functions for appspresso javascript API.

Method Summary

Method Attributes Method Name and Description
<static>  
ax.util.ajax(args)
performs an ajax request.
<static>  
ax.util.decodeJSON(json)
"safe-guard" for JSON.parse().
<static>  
ax.util.dump(obj, depth, indent, newline, separator)
make string representation from object.
<static>  
ax.util.encodeJSON(obj)
"safe-guard" for JSON.stringify().
<static>  
ax.util.evaluateJavaScript(script)
"safe-guard" for evil "eval".
<static>  
ax.util.foreach(obj, callback)
iterate all elements in object, array or array-like object.
<static>  
ax.util.format(text, var_args)
format string with variable arguments
'1 token, 0 args ({0})' -- '1 token, 0 args ({0})'
'1 token, 1 args ({0})', 'arg1' -- '1 token, 1 args (arg1)'
'1 tokens, 2 args ({0})', 'arg1', 'arg2' -- '1 tokens, 2 args (arg1)'
'2 tokens, 2 args ({0},{1})', 'arg1', 'arg2' -- '2 tokens, 2 args(arg1,arg2)'
'2 tokens swapped, 2 args ({1},{0})', 'arg1', 'arg2' -- '2 tokens swapped, 2 args (arg2,arg1)'
'4 tokens interwoven, 2 args ({0},{1},{0},{1})', 'arg1', 'arg2' -- '4 tokens interwoven, 2 args (arg1,arg2,arg1,arg2)'
<static>  
ax.util.getFunctionName(func)
get/guess function name from javascript function object.
<static>  
ax.util.invokeLater(obj, func)
<static>  
ax.util.isValidPath(var_args)
validate inputed path is available dir/file
<static>  
ax.util.parseXML(xml)
"safe-guard" for webkit's built-in DOMParser.
<static>  
ax.util.validateInstance(value, constructor, exception, name)
validate instance.
<static>  
ax.util.validateParam(param, mandatory, nullable, type, exception, name)
validate parameter.

Namespace Detail

ax.util
utility functions for appspresso javascript API.

Method Detail

  • <static> {object} ax.util.ajax(args)
    performs an ajax request.
    Parameters:
    {object} args
    Returns:
    {object} XMLHttpRequest
  • <static> {object} ax.util.decodeJSON(json)
    "safe-guard" for JSON.parse().
    Parameters:
    {string} json
    Returns:
    {object}
  • <static> {string} ax.util.dump(obj, depth, indent, newline, separator)
    make string representation from object. used for debugging.
    Parameters:
    {object} obj
    {number} depth
    (optional; default: 3)
    {string} indent
    (optional; default: '\t')
    {string} newline
    (optional; default: '\n')
    {string} separator
    (optional; default: ',' + newline + indent)
    Returns:
    {string}
  • <static> {string} ax.util.encodeJSON(obj)
    "safe-guard" for JSON.stringify().
    Parameters:
    {object} obj
    Returns:
    {string} json representation for the "obj"
  • <static> ax.util.evaluateJavaScript(script)
    "safe-guard" for evil "eval". call this method instead of the evil.
    Parameters:
    {string} script
    Returns:
    result
  • <static> {object} ax.util.foreach(obj, callback)
    iterate all elements in object, array or array-like object.
    Parameters:
    {object} obj
    {function} callback
    Returns:
    {object}
  • <static> {string} ax.util.format(text, var_args)
    format string with variable arguments
    '1 token, 0 args ({0})' -- '1 token, 0 args ({0})'
    '1 token, 1 args ({0})', 'arg1' -- '1 token, 1 args (arg1)'
    '1 tokens, 2 args ({0})', 'arg1', 'arg2' -- '1 tokens, 2 args (arg1)'
    '2 tokens, 2 args ({0},{1})', 'arg1', 'arg2' -- '2 tokens, 2 args(arg1,arg2)'
    '2 tokens swapped, 2 args ({1},{0})', 'arg1', 'arg2' -- '2 tokens swapped, 2 args (arg2,arg1)'
    '4 tokens interwoven, 2 args ({0},{1},{0},{1})', 'arg1', 'arg2' -- '4 tokens interwoven, 2 args (arg1,arg2,arg1,arg2)'
    
    Parameters:
    {string} text
    {...*} var_args
    Returns:
    {string}
  • <static> {string} ax.util.getFunctionName(func)
    get/guess function name from javascript function object.
    Parameters:
    {function} func
    Returns:
    {string} function name if available(named or named-inline), otherwise <> or <>
  • <static> ax.util.invokeLater(obj, func)
    Parameters:
    {object} obj
    {function} func
    args...
  • <static> {boolean} ax.util.isValidPath(var_args)
    validate inputed path is available dir/file
    Parameters:
    {...string} var_args
    Returns:
    {boolean}
  • <static> {XMLDocument} ax.util.parseXML(xml)
    "safe-guard" for webkit's built-in DOMParser.
    Parameters:
    {string} xml
    Returns:
    {XMLDocument}
  • <static> {boolean} ax.util.validateInstance(value, constructor, exception, name)
    validate instance. return true when the "value" object is instance of "constructor" function(aka class).
    Parameters:
    {object} value
    {function} constructor
    {boolean} exception
    {string} name
    Returns:
    {boolean}
  • <static> {boolean} ax.util.validateParam(param, mandatory, nullable, type, exception, name)
    validate parameter.
    Parameters:
    {*} param
    {boolean} mandatory
    {boolean} nullable
    {string} type
    "string" or "number"
    {boolean} exception
    {string} name
    Returns:
    {boolean}

    API Reference

    • Deviceapis
    • Devicestatus
    • Device Interaction
    • Contact
    • Accelerometer
    • Orientation
    • Geolocation
    • Camera
    • Messaging
    • Filesystem
    • Appspresso
      • ax
      • AxDef
      • AxPlugin
      • AxRequest
      • ax.bridge
      • ax.console
      • ax.util
    • Appspresso Extension
      • ax.ext.admob
      • ax.ext.android
      • ax.ext.contact
      • ax.ext.ios
      • ax.ext.ga
      • ax.ext.media
      • ax.ext.net
      • ax.ext.ui
      • ax.ext.zip
RSS
Twitter
© 2011 Appspresso.com . powered by Wordpress