Atom Module
get: function(obj,path)
This method is nullsafe.
Evaluates given path for object, as IE9 did not support properties, we had to introduce get_ accessor function, so this method checks if
get_ method exists and then evaluates the method or returns value at path.
Usage:
var v = Atom.get(appScope, "customerList.selectedItem.CustomerID");
set: function(obj,path,value)
This method is nullsafe.
Sets value at given property path, useful in providing nested property path. This is nullsafe, as it does not throw null exception,
it simply stops evaluating property chain.
This method will refresh bindings at every property in the chain, if you simply set value in JavaScript, Atoms framework cannot
refresh bindings.
Usage:
Atom.set(appScope, "customerList.selectedItem.CustomerID", 0);
time(): number
Calls (new Date) and returns getTime() value of it.
refreshWindowCommand()
Calls location.reload(true) method which you can set as action set. Note, do not put () after method name when you set it as action set.
Usage:
<button atom-event-click="{ Atom.refreshWindowCommand }" >Refresh Window </button>
merge: function(target, source, update, clone)
Merges properties of source into the given target and returns the target.
If clone is true, it will create clone of target and then call merge on it.
If update is true, it will use Atom.set and that will refresh the bindings.
url: function(url, query, hash)
Combines url fragments, where query and hash are javascript key-value objects, this method will encode key-value pairs as proper query string.
var q = Atom.url('/products/search', { name: 'new tv', start: 0, size: 100 });
// returns
"/products/search?name=new+tv&start=0&size=100"
This method is useful for binding url inside promises as well as href/src attributes.
csv: function(array,path,separator = ', ')
Returns comma separator string for property path in given array, this method internally uses Atom.get to evaluate properties. Let's
assume that you have loaded list of customers in your Items control and you want all ids of selected customers.
var selectedCustomers = Atom.get(appScope,"customerList.selectedItems");
var ids = Atom.csv(selectedCustomers, "CustomerID");
resolve(obj)
Returns a promise that will resolve when each promises inside given obj has been resolved successfully.
var p = Atom.resolve( {
countries: AtomPromise.json('/countries'),
categories: AtomPromise.json('/categories')
} );
// p is now a promise, which when resolved, will return
// {
// countries: [...]
// categories: [...]
// }