namespace smx
Global smx
namespace, one namespace to hold the whole framework.
The smx namespace can serves also as namespace function, see smx()
.
Details:
- Version:
- 2.1
Members
Methods
registerModule()
Registers a new module. Will add it to modules collection and will also extend smx core classes if the module defines any extension.
smx([s]) → {smx.Node|Array.<smx.Nodes>}
Global node wrapper, an useful shortcut for interacting with the current active document.
Notice that this method is a namespace function, is private inner function
attached directly onto smx namespace. Dont try to call this function as a
namespace member, use the smx
namespace itself as a function.
If the required parameter is a CSS selector string will return a collection
of Nodes
matching the given selector as a result of calling
Document.find
on the current active document.
If the paramater is single or array of XMLNode will return the input nodes wrapped as smx Nodes. Additionally if input are already smx Nodes will return already cached Nodes, so don't be afraid about rewraping nodes using this wrapper.
Parameters
Returns
-
{smx.Node|Array.<smx.Nodes>}
Example
//use it as a namespace function.
smx('library > book');
// => [SMXNode, SMXNode, SMXNode, ...]
//not like this
smx.smx('library > book');
// => Error: smx.smx is not a Function.
load(url, onSuccess, onError)
- async
- static
Loads a new smx document.
Parameters
-
url
{String}
-
onSuccess
{smx~onLoadSuccess}
-
onError
{smx~onLoadError}
Type Definitions
onLoadSuccess(document)
Callback function when loading completes succefully.
Parameters
-
document
{SMXDocument}
:Just loaded document
onLoadError(error)
Callback function used loading throws an error.
Parameters
-
error
{Error}
:Error object