Namespace ax.util
utility functions for appspresso javascript API.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
utility functions for appspresso javascript API.
|
Method Summary
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}
