Namespace jabberwerx.util (MINIMAL)
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
jabberwerx.util.config
|
| <static> |
jabberwerx.util.debug
Jabberwerx debug console. |
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
jabberwerx.util.clearGraph(tag)
Clears storage associated with the namespace |
| <static> |
jabberwerx.util.clone(The)
Depth-first recursively clone passed argument. |
| <static> |
jabberwerx.util.decodeSerialization(s)
Decodes a string from an obfuscated form. |
| <static> |
jabberwerx.util.encodeSerialization(s)
Encodes a string into an obfuscated form. |
| <static> |
jabberwerx.util.findReachableGUIDs(start)
|
| <static> |
jabberwerx.util.generateInvocation(object, methodName, boundArguments)
Invocations are function objects that do two nifty things. |
| <static> |
jabberwerx.util.getLoadedGraphAge(tag)
Return the delta in dates between when the graph was saved and now. |
| <static> |
jabberwerx.util.getLoadedGraphTimestamp(tag)
Return the date at which a graph was saved. |
| <static> |
jabberwerx.util.getMaxGraphAge()
Retrieve the maximum age a persisted graph can be before it is ignored and cleared on load |
| <static> |
jabberwerx.util.invoke(invocationObject)
Invoke an invocation function object. |
| <static> |
jabberwerx.util.isArray(it)
Adapted from dojo.isArray Checks if the parameter is an Array. |
| <static> |
jabberwerx.util.isGraphSaved(tag)
Returns true if the storage engine reports that the passed tag has a value
stored in the namespace |
| <static> |
jabberwerx.util.isJWInvocation(ref)
Determines if the passed reference is one of our invocation objects. |
| <static> |
jabberwerx.util.isJWObjGUID(ref)
Determines if the passed reference is a GUID for a JWBase-derived object. |
| <static> |
jabberwerx.util.isJWObjRef(ref)
Determines if the passed reference is a JWBase-derived object. |
| <static> |
jabberwerx.util.isString(it)
Adapted from dojo.isString Checks if the parameter is a String. |
| <static> |
jabberwerx.util.loadGraph(tag)
Returns a ref to the root object originally stored with this tag, connected to its stored graph. |
| <static> |
jabberwerx.util.map(arr, callback, thisObject)
Adapted from dojo.map Applies callback to each element of arr and returns an Array with the results. |
| <static> |
jabberwerx.util.newObjectGUID(className)
Generate a quasi-guid for object tracking. |
| <static> |
jabberwerx.util.saveGraph(root, tag, callback)
Save an object graph. |
| <static> |
jabberwerx.util.serialize(it, prettyPrint, _indentStr)
Adapted from dojo.toJson Serialize an object; Object cycles will cause inifinite recursion. |
| <static> |
jabberwerx.util.serializeXML(n)
Generates XML for the given Node. |
| <static> |
jabberwerx.util.setDebugStream(streamName, value)
Add or overwrite the setting on a debug stream. |
| <static> |
jabberwerx.util.setMaxGraphAge(age)
Set the maximum age a persisted graph can be before it is ignored and cleared on load |
| <static> |
jabberwerx.util.slugify(string, separator)
Almost, but not quite, like WordPress's sanitizetitlewithdashes. |
| <static> |
jabberwerx.util.unserializeXML(s, wrap)
Parses the passed XML and returns the document element. |
| <static> |
jabberwerx.util.unserializeXMLDoc(s, wrap)
Pass an xml string, get back an xml document. |
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Deprecated:
- do not use
Jabberwerx debug console. Exposes a subset of Firebug methods including log, warn, error, info, debug and dir. Jabberwerx console methods may only be passed one log message (Firebug allows formatted strings and values, ala printf) and a "stream". Streams are message types and allow finer filtering of log messages.
For example jabberwerx.util.debug.log("my foo", "bar") will log "my foo" if the stream "bar" is enabled see jabberwerx.util.setDebugStream.
If the built in console (window.console) does not support a particular method the given message is not logged.
Clears storage associated with the namespace _jw_store_.
If no tag is passed, the entire namespace is cleared. Otherwise, only the store marked by the passed tag is cleared.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {String} tag Optional
- Optionally specify a specific, tagged store to clear.
Depth-first recursively clone passed argument. Cyclical references will result in infinite recursion. Will shallow-copy an argument's prototype if it exists, and will shallow-copy functions.
- Parameters:
- {arg} The
- object/array/whatever to clone.
- Returns:
- {Anything} The new cloned whatever.
Decodes a string from an obfuscated form.
- Parameters:
- {String} s
- The string to decode
- Returns:
- {String} The un-obfuscated form of {s}
Encodes a string into an obfuscated form.
- Parameters:
- {String} s
- The string to encode
- Returns:
- {String} The obfuscated form of {s}
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {CFBase} start
- The object at which to start traversing.
- Deprecated:
- Traverses the object graph from the passed object and records the guids of evey object reachable from the passed object.
- Returns:
- {String[]} An array of guids.
Invocations are function objects that do two nifty things.
- They wrap an (optional) JW object reference and method name, and an invocation of the bare invocation object reference is secretly an invocation of the named method on the JW object.
- We treat invocation objects specially during serialization and unserialization. They carry their object GUID and method name along with them into persistence-land, and we rehydrate that info into a real function when we load the graph.
The former nifty thing means you can pass an invocation object as a callback to any service expecting a bare function reference, and, when invoked, the callback will be applied within object scope, rather than global scope.
We also cache invocation objects, so you will always get the same function object back from each call to generateInvocation when passing the same object and method name. This is useful for registering an invocation as a handler for some service that registers/unregisters handlers by function reference, (eg, dom or jQuery events) and then unregistering it later.
The latter nifty thing means that callback handlers among JW objects will be preserved across graph loading and storing and automatically re-connected when the graph is rehydrated. That's assuming, of course, that the target object was stored in the graph to begin with. Since models are generally stored, callback networks among model objects can be expected to be stored, while callbacks involving other kinds of objects will have to be re-created after unserialization. jabberwerx.JWBase.wasUnserialized and jabberwerx.JWBase.graphUnserialized are usually good places to do this.
- Parameters:
- {jabberwerx.JWBase} object
- Any JW object
- {String} methodName
- The name of the method this invocation represents.
- {Array} boundArguments Optional
- An optional array of arguments to pass to the invocation. These will PRECEED any arguments passed to the invocation at the actual call site.
- Returns:
- {function} object An "invocation"-type function object.
Return the delta in dates between when the graph was saved and now.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {String} tag Optional
- The tag of the saved graph (returns null if null/undefined)
- Returns:
- {Date} The delta in dates between when the graph was saved and now. Returns null if tag is null/undefined, or if no store with stored tag could be found.
Return the date at which a graph was saved. A graph must have been loaded via jabberwerx.util.loadGraph.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {String} tag
- Tag name for the stored graph.
- Returns:
- {Date} Date at which a graph was saved. Returns null if no graph was found for passed in tag value.
Retrieve the maximum age a persisted graph can be before it is ignored and cleared on load
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Returns:
- {Number} The maximum age
Invoke an invocation function object. Clients shouldn't need to call this.
The first argument is the invocation object, remaining arguments are arguments to pass through to the method.
- Parameters:
- {Object} invocationObject
- The invocation object.
- {Anything} ... Optional
- Remaining arguments are passed on to the invocation method.
Adapted from dojo.isArray
Checks if the parameter is an Array.
- Parameters:
- {Object} it
- Object to check.
- Returns:
- {Boolean} true if object is an array, false otherwise.
Returns true if the storage engine reports that the passed tag has a value
stored in the namespace _jw_store_.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {String} tag
- Tag name for the stored graph.
- Throws:
- {jabberwerx.util.JWStorageRequiresjQueryjStoreError}
- if `_jw_store_` does not exist, or if it is not ready.
- Returns:
- {Boolean} true if the storage engine reports that the passed tag has a value stored in the namespace `_jw_store_`, otherwise false.
Determines if the passed reference is one of our invocation objects.
- Parameters:
- {Object} ref
- Reference to check.
- Returns:
- {Boolean} true if passed reference is one of our invocation objects, otherwise false.
Determines if the passed reference is a GUID for a JWBase-derived object.
- Parameters:
- {Object} ref
- Reference to check.
- Returns:
- {Boolean} true if passed reference is a GUID for a JWBase-derived object, otherwise false.
Determines if the passed reference is a JWBase-derived object.
- Parameters:
- {Object} ref
- Reference to check.
- Returns:
- {Boolean} true if passed reference is a JWBase-derived object, otherwise false.
Adapted from dojo.isString
Checks if the parameter is a String.
- Parameters:
- {Object} it
- Object to check.
- Returns:
- {Boolean} true if object is a string, false otherwise.
Returns a ref to the root object originally stored with this tag, connected to its stored graph.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {String} tag
- Tag name stored with root object.
- Throws:
- {jabberwerx.util.JWStorageRequiresjQueryjStoreError}
- if it is not ready.
- Returns:
- {CFBase} The root object originally stored with this tag.
Adapted from dojo.map
Applies callback to each element of arr and returns an Array with the results. This function corresponds to the JavaScript 1.6 Array.map() method. In environments that support JavaScript 1.6, this function is a passthrough to the built-in method.
For more details, see: http://developer.mozilla.org/en/CoreJavaScript1.5Reference/GlobalObjects/Array/map
- Parameters:
- {Array|String} arr
- The array to iterate on. If a string, operates on individual characters.
- {Function|String} callback
- The function is invoked with three arguments: item, index, and array and returns a value
- {Object} thisObject Optional
- May be used to scope the call to callback
- Returns:
- {Array} passed in array after the callback has been applied to each item
Generate a quasi-guid for object tracking.
- Parameters:
- {String} className
- Class name of object.
- Returns:
- {String} a new guid
Save an object graph.
Pass an object to act as the "root" of the graph. Any objects you need to save should be reachable from this root. This is the object you will get back when you call jabberwerx.util.loadGraph.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {CFBase} root
- A "root" JWBase or plain object for the graph.
- {String} tag
- A name for the stored graph.
- {Function} callback
- A callback to be invoked when the save is complete.
- Throws:
- {jabberwerx.util.JWStorageRequiresjQueryjStoreError}
- if `_jw_store_` does not exist, or if it is not ready.
Adapted from dojo.toJson
Serialize an object; Object cycles will cause inifinite recursion.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {Object} it
- Object at which to start traversing the graph.
- {Boolean} prettyPrint
- Whether to include newlines and tabs in the output.
- {String} _indentStr
- Private to the recursion; clients shouldn't pass anything.
- Returns:
- {String} the JSON-serialization of the object
Generates XML for the given Node.
- Parameters:
- {XML DOM Node} n
- XML node
- Returns:
- {String} XML for given node n. null if n is undefined.
Add or overwrite the setting on a debug stream.
- Parameters:
- {String} streamName
- Debug stream name
- {String} value
- Debug stream value to set.
Set the maximum age a persisted graph can be before it is ignored and cleared on load
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/jwapp/JWPersist.js>.
- Parameters:
- {Number} age Optional
- The maximum age in seconds, ignored if undefined or <= 0.
- Returns:
- {Number} The maximum age
Almost, but not quite, like WordPress's sanitizetitlewithdashes. http://codex.wordpress.org/FunctionReference/sanitizetitlewith_dashes
The difference with this implementation is that the seperator can be specified as an input parameter.
- Parameters:
- {String} string
- String which to slugify
- {String} separator
- String value which to replace '-' with in string.
- Returns:
- {String} string but with all instances of '-' replaced with seperator.
Parses the passed XML and returns the document element.
Similar to jabberwerx.util.unserializeXMLDoc
- Parameters:
- {String} s
- The XML to convert into DOM objects
- {String} wrap Optional
- The name of a tag in which you'd like your xml wrapped.
- Returns:
- {Element} An XML document element.
Pass an xml string, get back an xml document. Optionally pass the name of a tag in which to wrap the result.
- Parameters:
- {String} s
- The XML to convert into DOM objects
- {String} wrap Optional
- The name of a tag in which you'd like your xml wrapped.
- Returns:
- {Document} An XML document.