Class baja.Component
Extends
baja.Complex.
Represents a baja:Component in BajaScript.
Component is the required base class for all Baja component classes.
Just like Niagara, 'baja:Component' contains a lot of the core functionality of the framework.
Unlike 'baja:Struct', a Component can contain both frozen and dynamic Slots. Frozen Slots are
defined at compile time (typically hard coded in Java) and Dynamic Slots can be added at
runtime (i.e. when the Station is running). There are three different types of Slots that
a Component can contain (Property, Action and Topic).
Defined in: comp.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
- Fields borrowed from class baja.Object:
- getIcon
| Method Attributes | Method Name and Description |
|---|---|
| <private> |
$fw(x, a, b, c, d)
Internal Framework Method.
|
|
add(obj)
Add a dynamic Property to a Component.
|
|
|
attach(event, func)
Attach an Event Handler to this Component instance.
|
|
|
detach(hName, func)
Detach an Event Handler from the Component.
|
|
|
fire(obj)
Fire a Topic.
|
|
|
Returns the default parameter for an Action.
|
|
|
Return the Component Space.
|
|
|
Return the Component's handle.
|
|
|
getHandlers(hName)
Return an array of event handlers.
|
|
|
Return the knob count for the Component.
|
|
|
getKnobs(slot)
Return the Knobs for a particular Slot or the whole Component.
|
|
|
getLinks(slot)
Return the Links for a particular Slot or the whole Component.
|
|
|
getNavChildren(obj)
Access the Nav Children for the Component.
|
|
|
Return the Nav Description for the Component.
|
|
|
Return the Nav Display Name for the Component.
|
|
|
Return the Nav Icon for the Component.
|
|
|
Return the Nav Name for the Component.
|
|
|
Return the Nav ORD for the Component.
|
|
|
Return the Nav Parent for the Component.
|
|
|
Return the ORD in session for this Component.
|
|
|
Return the permissions for this Component.
|
|
|
Return the Slot Path of the Component.
|
|
|
getUniqueName(slotName)
Return a unique name for a potential new Slot in this Component.
|
|
|
hasHandlers(hName)
Return true if there any handlers registered for the given handler name.
|
|
|
invoke(obj)
Invoke an Action.
|
|
|
Return true if the Component is mounted inside a Space.
|
|
|
Is the Component subscribed?
|
|
| <static> |
baja.Component.lease(obj)
Subscribe a number of Components for a period of time.
|
|
lease(obj)
Subscribe a Component for a period of time.
|
|
|
Load all of the Slots on the Component.
|
|
|
makeLink(obj)
Create an instance of a Link to use for a link to the specified source Component.
|
|
|
remove(obj)
Remove the dynamic Slot by the specified name.
|
|
|
rename(obj)
Rename the specified dynamic Slot.
|
|
|
reorder(obj)
Reorder the Component's dynamic Properties.
|
|
|
serverSideCall(obj)
Make a Server Side Call.
|
|
|
setFacets(obj)
Set a dynamic Slot's facets.
|
|
|
setFlags(obj)
Set a Slot's flags.
|
|
|
Return the path string of the Component.
|
- Methods borrowed from class baja.Complex:
- contractCommitted, equivalent, get, getDisplay, getDisplayName, getFacets, getFlags, getName, getParent, getPropertyInParent, getSlot, getSlots, getValueOf, has, newCopy, set, toString
- Parameters:
- x
- a
- b
- c
- d
- See:
- baja.Complex#$fw
If the value extends baja:Action, the new slot is also an Action. If the value extends baja:Topic, the new slot is also a Topic.
If the Complex is mounted, this will asynchronously add the Property to the Component on the Server.
An Object Literal is used to specify the method's arguments...
myObj.add({
slot: "foo",
value: "slot value",
facets: baja.Facets.make(["doo"], ["boo"]), // Optional
flags: baja.Flags.SUMMARY, // Optional
ok: function (prop) {
// Called once the Property has been added (optional)
},
fail: function (err) {
// Called if the Property fails to add (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Object} obj
- the Object Literal for the method's arguments.
- {String} obj.slot
- the Slot name the unique name to use as the String key for the slot. If null is passed, then a unique name will automatically be generated. If the name ends with the '?' character a unique name will automatically be generated by appending numbers to the specified name. The name must meet the "name" production in the SlotPath BNF grammar. Informally this means that the name must start with an ascii letter and contain only ascii letters, ascii digits, or '_'. Escape sequences can be specified using the '$' char. Use baja.SlotPath.escape() to escape illegal characters.
- {Object} obj.value
- the value to be added (Type must extend baja:Value).
- {Number} obj.flags Optional
- optional Slot flags.
- {baja.Facets} obj.facets Optional
- optional Slot Facets.
- {Function} obj.ok Optional
- the ok callback. This function is called once the Property has been added to the Server. The function is passed the new Property that has just been added.
- {Function} obj.fail Optional
- the fail callback. This function is called if the Property fails to add. Any error information is passed into this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object
- obj.cx Optional
- the Context (used internally by BajaScript).
- Returns:
- if not mounted, the newly added Property. Otherwise null is returned.
When an instance of Component is subscribed to a Component running in the Station, BajaScript can be used to listen for Component Events. For instance, a common one would be a Property changed event...
// myPoint is a mounted and subscribed Component...
myPoint.attach("changed", function (prop, cx) {
if (prop.getName() === "out") {
baja.outln("The output of the point is: " + this.getOutDisplay());
}
});
Therefore, an event handler consists of a name and a function. When the
function is called, 'this' will map to the target Component the handler
is attached too.
For a list of all the event handlers and some of this method's more advanced features, please see baja.Subscriber#attach.
If no arguments are used with this method then all events are removed.
For some of this method's more advanced features, please see baja.Subscriber#detach.
For a list of all the event handlers, please see baja.Subscriber#attach.
- Parameters:
- {String} hName Optional
- the name of the handler to detach from the Component.
- {Function} func Optional
- the function to remove from the Subscriber. It's recommended to supply this just in case other scripts have added event handlers.
If the Complex is mounted, this will asynchronously fire the Topic on the Component in the Server.
A Slot, Slot name or an Object Literal can used for the method's arguments...
// Fire the Topic via its Topic Slot...
myObj.fire(fooTopic);
// ...or via the Topic's Slot name...
myObj.fire("foo");
// ...or for more arguments, use an Object Literal...
myObj.fire({
slot: topicSlot, // Can also be a Topic Slot name
value: "the Topic event argument",
ok: function () {
// Called once the Topic has been fired (optional)
},
fail: function (err) {
// Called if the Topic fails to fire (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
Please note that auto-generated convenience methods are created and added to a Component for firing frozen Topics...
// Fire a Topic called 'foo'
myObj.fireFoo();
// Fire a Topic called foo with an event argument...
myObj.fireFoo("the Topic event argument");
// ...or via an Object Literal for more arguments...
myObj.fireFoo({
value: "the Topic event argument",
ok: function () {
// Called once the Topic has been fired (optional)
},
fail: function (err) {
// Called if the Topic fails to fire (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
If the name of the auto-generated Topic method is already used, BajaScript will attach a number to the end
of the method name so it becomes unique.
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {baja.Action|String|Object} obj
- the Topic, Topic name or Object Literal for the method's arguments.
- {baja.Action|String} obj.slot
- the Topic or Topic name.
- obj.value Optional
- the Topic's event.
- {Function} obj.ok Optional
- the ok callback. This function is called once Topic has been fired.
- {Function} obj.fail Optional
- the fail callback. This function is called if the Topic fails to fire. Any error information is passed into this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- obj.cx Optional
- the Context (used internally by BajaScript).
For unmounted Components, by default it calls Action.getParameterDefault().
If mounted in a Proxy Component Space, this will result in an asynchronous network call.
Here's an example of how to invoke the method...
// A resolved and mounted Component...
myComp.getActionParameterDefault({
slot: "myAction",
ok: function (param) {
// Called once we're received the parameter. Note that param can be null
// if there's no parameter for the Action.
},
fail: function (err) {
// Called if the method throws an exception on the Server or can't execute for some reason (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
<\pre>
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Object} obj
- the Object Literal for the method's arguments.
- {baja.Action|String} obj.slot
- the Action or Action name.
- {Function} obj.ok Optional
- the ok callback. Called once the Action Parameter Default has been received. Any return value is passed to this function (could be null if no Action parameter is defined).
- {Function} obj.fail Optional
- the fail callback.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- Returns:
- {baja.Value} if the Component is not mounted in a Proxy Component Space, this method will return a value. If there's no Action Parameter Default then null will be returned.
- Returns:
- the Component Space for this Component (if mounted) otherwise return null.
- Returns:
- {String} handle for this Component (if mounted) otherwise return null.
For a list of all the event handlers, please see baja.Subscriber#attach.
To access multiple handlers, insert a space between the handler names.
- Parameters:
- {String} hName
- the name of the handler
- Returns:
- {Array}
- Returns:
- {Number} the number of knobs installed on the Component
If no slot is passed in all the knobs for the Component will be returned.
- Returns:
- {Array} array of knobs
If no slot is passed in all the links for the Component will be returned.
- Returns:
- {Array} array of links.
- Parameters:
- obj
- Returns:
- {String}
- Returns:
- {String}
- Returns:
- {baja.Icon}
- Returns:
- {String}
- Returns:
- {baja.Ord} the Nav ORD or null if it's not mounted.
- Returns:
- parent Nav Node
- Returns:
- {baja.Ord} ORD in Session for this Component (or null if not mounted).
- Returns:
- {baja.Permissions}
- Returns:
- {baja.SlotPath} the Slot Path or null if not mounted.
Please note, this method inspects the current Slots this Component has loaded to find a unique name. Therefore, if this Component is a Proxy, it must be fully loaded and subscribed. Also please refrain from using this method in a batch operation since it's likely the other operations in the batch will influence a Slot name's uniqueness.
- Parameters:
- {String} slotName
- the initial Slot name used to ensure uniqueness. This must be a valid Slot name.
- Returns:
- {String} a unique name.
If no handler name is specified then test to see if there are any handlers registered at all.
Multiple handlers can be tested for by using a space character between the names.
For a list of all the event handlers, please see baja.Subscriber#attach.
- Parameters:
- {String} hName Optional
- the name of the handler. If undefined, then see if there are any handlers registered at all.
- Returns:
- {Boolean}
If the Complex is mounted, this will asynchronously invoke the Action on the Component in the Server.
A Slot, Slot name or an Object Literal can used for the method's arguments...
// Invoke the Action via its Action Slot...
myObj.invoke(fooAction);
// ...or via the Action's Slot name...
myObj.invoke("foo");
// ...or for more arguments, use an Object Literal...
myObj.invoke({
slot: actionSlot, // Can also be an Action Slot name
value: "the Action's argument",
ok: function (returnValue) {
// Called once the Action has been invoked (optional)
},
fail: function (err) {
// Called if the Action fails to invoke (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
Please note that auto-generated convenience methods are created and added to a Component for invoking frozen Actions...
// Invoke an Action called 'override'. Pass in an argument
myPoint.override(overrideVal);
// ...or via an Object Literal for more arguments...
myPoint.override({
value: overrideVal,
ok: function (returnValue) {
// Called once the Action has been invoked (optional)
},
fail: function (err) {
// Called if the Action fails to invoke (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
If the name of the auto-generated Action method is already used, BajaScript will attach a number to the end
of the method name so it becomes unique. For example, the 'set' Action on a NumericWritable would be called 'set1'
because Component already has a 'set' method.
- Parameters:
- {baja.Action|String|Object} obj
- the Action, Action name or Object Literal for the method's arguments.
- {baja.Action|String} obj.slot
- the Action or Action name.
- obj.value Optional
- the Action's argument.
- {Function} obj.ok Optional
- the ok callback. This function is called once Action has been invoked. If the Action has a returned argument, this will be passed to this function.
- {Function} obj.fail Optional
- the fail callback. This function is called if the Action fails to invoke. Any error information is passed into this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- obj.cx Optional
- the Context (used internally by BajaScript).
- Returns:
- {Boolean}
- Returns:
- {Boolean}
The default period of time is 10 seconds.
Please note that a baja.Subscriber can also be used to put a Component into and out of subscription.
If the Component is mounted and it can be subscribed, this will result in an asynchronous network call.
If any of the the Components are already leased, the lease timer will just be renewed.
A time (Number or baja.RelTime) or an Object Literal can be used to specify the method's arguments...
// Lease an array of Components for the default time period
myComp.lease([comp1, comp2, comp3]);
// ...or lease for 2 and half minutes...
myComp.lease({
time: baja.RelTime.make({minutes: 2, seconds: 30}),
comps: [comp1, comp2, comp3]
});
For callbacks, the 'this' keyword is set to whatever the 'comps' argument was originally set to.
- Parameters:
- {Object} obj
- an Object Literal for the method's arguments.
- {Array|baja.Component} obj.comps
- the Components to be subscribed.
- {Function} obj.ok Optional
- the ok callback. Called once the Component has been unsubscribed.
- {Function} obj.fail Optional
- the fail callback. Called if the Component fails to unsubscribe. Any errors will be passed to this function.
- {Number|RelTime} obj.time Optional
- the number of milliseconds or RelTime for the lease.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object. The timer will only be started once the batch has fully committed.
The default lease time is 10 seconds.
Please note that a baja.Subscriber can also be used to put a Component into and out of subscription.
If the Component is mounted and it can be subscribed, this will result in an asynchronous network call.
If lease is called while the Component is already leased, the timer will just be renewed.
A time (Number or baja.RelTime) or an Object Literal can be used to specify the method's arguments...
// Lease for 15 seconds
myComp.lease(15000);
// ...or lease for 2 and half minutes...
myComp.lease(baja.RelTime.make({minutes: 2, seconds: 30}));
// ...or lease using an Object Literal for more arguments...
myComp.lease({
time: 1000, // in milliseconds. Can also be a RelTime.
ok: function () {
// Called once the Component is subscribed (optional)
},
fail: function (err) {
// Called if the Component failed to subscribe (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Number|baja.RelTime|Object} obj Optional
- the number of milliseconds, RelTime or an Object Literal for the method's arguments.
- {Function} obj.ok Optional
- the ok callback. Called once the Component has been unsubscribed.
- {Function} obj.fail Optional
- the fail callback. Called if the Component fails to unsubscribe. Any errors will be passed to this function.
- {Number|RelTime} obj.time Optional
- the number of milliseconds or RelTime for the lease.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object. The timer will only be started once the batch has fully committed.
An optional Object Literal can be used to specify the method's arguments...
myComp.loadSlots({
ok: function () {
// Called once the Component is loaded (optional)
},
fail: function (err) {
// Called if the Component failed to load (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Function} obj.ok Optional
- the ok callback. Called once the Component has been loaded.
- {Function} obj.fail Optional
- the fail callback. Called if the Component fails to load. Any errors will be passed to this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
For unmounted Components, by default this method returns a plain baja:Link instance. If mounted in a Proxy Component Space, this will result in an asynchronous network call. <\pre> For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Object} obj
- the Object Literal for the method's arguments.
- {baja.Component} obj.source
- the source Component for the link.
- {baja.Slot|String} obj.sourceSlot
- the source Slot or Slot name.
- {baja.Slot|String} obj.targetSlot
- the target Slot or Slot name.
- {Function} obj.ok Optional
- the ok callback. A link will be passed as an argument to this function.
- {Function} obj.fail Optional
- the fail callback.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- Returns:
- {baja.Value} if the Component is not mounted in a Proxy Component Space, this method will return a value.
If the Complex is mounted, this will asynchronously remove the Property from the Component on the Server.
The Slot, Slot name, a Complex or an Object Literal can be used for the method's arguments...
myObj.remove("foo");
//...or via the Slot itself...
myObj.remove(theFooSlot);
//...or remove the Complex instance from the parent...
myObj.remove(aComplexInstance);
//... of if more arguments are needed then via Object Literal notation...
myObj.remove({
slot: "foo",
ok: function () {
// Called once the Property has been removed (optional)
},
fail: function (err) {
// Called if the Property fails to remove (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {baja.Slot|String|Object} obj
- the Slot, Slot name, Complex instance or an Object Literal.
- {String} obj.slot
- the Slot, Slot name or Complex instance to remove.
- {Function} obj.ok Optional
- the ok callback. This function is called once the Property has been remove from the Server.
- {Function} obj.fail Optional
- the fail callback. This function is called if the Property fails to remove. Any error information is passed into this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- obj.cx Optional
- the Context (used internally by BajaScript).
If the Complex is mounted, this will asynchronously rename the Slot in the Component on the Server.
An Object Literal is used for the method's arguments...
myObj.rename({
slot: "foo",
newName: "boo",
ok: function () {
// Called once the Slot has been renamed (optional)
},
fail: function (err) {
// Called if the Slot fails to rename (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Object} obj
- the Object Literal used for the method's arguments.
- {baja.Slot|String} obj.slot
- the dynamic Slot or dynamic Slot name that will be renamed
- {String} obj.newName
- the new name of the Slot. The name must meet the "name" production in the SlotPath BNF grammar. Informally this means that the name must start with an ascii letter, and contain only ascii letters, ascii digits, or '_'. Escape sequences can be specified using the '$' char. Use baja.SlotPath.escape() to escape illegal characters.
- {Function} obj.ok Optional
- the ok callback. This function is called once the Slot has been renamed.
- {Function} obj.fail Optional
- the fail callback. This function is called if the Slot fails to rename. Any error information is passed into this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- obj.cx Optional
- the Context (used internally by BajaScript).
If the Complex is mounted, this will asynchronously reorder the dynamic Properties in the Component on the Server.
An Property array or an Object Literal can used for the method's arguments...
// Order via an array of Properties...
myObj.reorder([booProp, fooProp, dooProp]);
// ...or order via an array of Property names...
myObj.reorder(["boo", "foo", "doo"]);
// ...or for more arguments, use an Object Literal...
myObj.reorder({
dynamicProperties: [booProp, fooProp, dooProp], // Can also be a Property name array!
ok: function () {
// Called once the Properties have been reordered (optional)
},
fail: function (err) {
// Called if the Slot fails to reorder (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Array|Object} obj
- the array of Properties, Property names or an Object Literal used for the method's arguments.
- {Array} obj.dynamicProperties
- an array of Properties or Property names for the slot order.
- {Function} obj.ok Optional
- the ok callback. This function is called once the dynamic Properties have been reordered.
- {Function} obj.fail Optional
- the fail callback. This function is called if the dynamic Properties fail to reorder. Any error information is passed into this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- obj.cx Optional
- the Context (used internally by BajaScript).
Sometimes it's useful to invoke a method on the server from BajaScript. A Server Side Call is how this is achieved.
This will result in an asynchronous network call.
In order to make a Server Side Call, the developer needs to first create a Niagara (Server Side) class that implements the box:javax.baja.box.BIServerSideCallHandler interface. The implementation should also declare itself as an Agent on the target Component Type (more information in Java interface docs). Here's an example of how a method implemented by this handler can be invoked...
// A resolved and mounted Component...
myComp.serverSideCall({
typeSpec: "foo:MyServerSideCallHandler", // The TypeSpec (moduleName:typeName) of the Server Side Call Handler
methodName: "bar", // The name of the public method we wish to invoke in the handler
value: "the argument for the method", // The argument to pass into the method (this can be any Baja Object/Component structure).
It will be deserialized automatically by Niagara.
ok: function (returnVal) {
// Called once the method has been executed on the Server (optional)
},
fail: function (err) {
// Called if the method throws an exception on the Server or can't execute for some reason (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
<\pre>
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Object} obj
- the Object Literal for the method's arguments.
- {String} obj.typeSpec
- the type specification of the Server Side Call Handler (moduleName:typeName).
- {String} obj.methodName
- the name of the method to invoke in the Server Side Call Handler
- obj.value
- the value for the server side method argument (must be a BajaScript Type)
- {Function} obj.ok Optional
- the ok callback. Called once the Server Side Call has been invoked. Any return value is passed to this function.
- {Function} obj.fail Optional
- the fail callback. Called if the Component fails to load. Any errors will be passed to this function.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
If the Complex is mounted, this will asynchronously change the facets on the Server.
An Object Literal is used to specify the method's arguments...
myObj.setFacets({
slot: "outsideAirTemp",
facets: baja.Facets.make(["foo"], ["boo"]),
ok: function () {
// Called once the Facets have been set (optional)
},
fail: function (err) {
// Called if the facets fail to change (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Object} obj
- the Object Literal for the method's arguments.
- {baja.Slot|String} obj.slot
- the Slot of Slot name.
- {baja.Facets} obj.facets
- the new facets for the dynamic Slot.
- {Function} obj.ok Optional
- the ok function callback. Called once the method has succeeded.
- {Function} obj.fail Optional
- the fail function callback. Called if this method has an error.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- obj.cx Optional
- the Context (used internally by BajaScript).
If the Complex is mounted, this will asynchronously set the Slot Flags on the Server.
An Object Literal is used to specify the method's arguments...
myObj.setFlags({
slot: "outsideAirTemp",
flags: baja.Flags.SUMMARY,
ok: function () {
// Called once the Flags have been set (optional)
},
fail: function (err) {
// Called if the flags fail to set (optional)
},
batch // if defined, any network calls will be batched into this object (optional)
});
For callbacks, the 'this' keyword is set to the Component instance.
- Parameters:
- {Object} obj
- the Object Literal for the method's arguments.
- {baja.Slot|String} obj.slot
- the Slot of Slot name.
- {Number} obj.flags
- the new flags for the Slot.
- {Function} obj.ok Optional
- the ok function callback. Called once the method has succeeded.
- {Function} obj.fail Optional
- the fail function callback. Called if this method has an error.
- {baja.comm.Batch} obj.batch Optional
- if defined, any network calls will be batched into this object.
- obj.cx Optional
- the Context (used internally by BajaScript).
- Returns:
- {String} the Path String or null if not mounted.