Instance Properties
-
id: String
-
UUID of this machine, or "localhost".
-
hostname: String
-
The hostname of the machine. Only guarenteed to be available on localhost; may be null for other machines.
Instance Methods
-
_addCap(name, props) → {Capability} common/models/machine.js, line 313
-
Adds a capability to this machine.
Argument Type Description name
String Name for the Capability
props
Object.<String, String> Arbitrary properties
capability The new capability
-
_removeCap(name) → {Capability} common/models/machine.js, line 361
-
Removes a capability from this machine.
Argument Type Description name
String Name of the capability.
capability The removed capability
-
_sharedDB(name) → {Lens.DB} common/models/machine.js, line 181
-
Finds a shared database that this machine is the master for.
Argument Type Description name
String The name of the database.
A
Lens.DB
, or null if there is no such database. -
capabilities() → {Array.<Capability>} common/models/machine.js, line 101
-
Returns the capabilities advertised by this machine.
An array of
Capability
-
capability(name) → {Capability} common/models/machine.js, line 114
-
Finds a capability by name.
Argument Type Description name
String The name of the capability.
A
Capability
, or null if there is no such capability. -
db(name) → {Lens.DB} common/models/machine.js, line 164
-
Finds a database published by this machine.
Argument Type Description name
String The name of the database.
A
Lens.DB
, or null if there is no such database. -
dbs() → {Array.<Lens.DB>} common/models/machine.js, line 151
-
Returns the databases published by this machine.
An array of
Lens.DB
-
ensure(capName, callback) → {Promise} common/models/machine.js, line 228
-
Ensures that this Machine has the given capability. Succeeds if the capability is already enabled or if a request to enable it succeeds; fails if a request to enable it fails.
Argument Type Attributes Description capName
String Name of the capability.
callback
function <optional>
This callback is invoked if the request is successful.
A jQuery promise. You can attach callbacks using this promise or use jQuery's tools to do parallel requests. If you passed a callback, that callback will automatically be registered as a success handler for this promise.
-
isLocalhost() → {Boolean} common/models/machine.js, line 210
-
Returns true if this is the local LuXoR device.
-
name() → {String} common/models/machine.js, line 86
-
Returns the name of this machine: Either the hostname, or, if the hostname is unavailable, the UUID. For localhost, always returns "localhost".
-
registerValuedRPC(name, fn) → {Binding} common/models/machine.js, line 293
-
Registers a new RPC that returns a value. Nearby machines will be able to call this RPC.
Throws an error if called on a machine other than localhost.
See RPCs for information on defining RPCs.
Argument Type Description name
String Name of the RPC.
fn
function A function that implements the RPC.
A binding. Clearing this binding will deregister the RPC.
-
registerVoidRPC(name, fn) → {Binding} common/models/machine.js, line 269
-
Registers a new RPC that doesn't return a value. Nearby machines will be able to call this RPC.
Throws an error if called on a machine other than localhost.
See RPCs for more information on defining RPCs.
Argument Type Description name
String Name of the RPC.
fn
function A function that implements the RPC.
A binding. Clearing this binding will deregister the RPC.
-
rpc(name) → {RPC} common/models/machine.js, line 138
-
Finds an RPC by name.
Argument Type Description name
String The name of the RPC.
An
RPC
, or null if there is no such RPC. -
rpcs() → {Array.<RPC>} common/models/machine.js, line 126
-
Returns the RPCs advertised by this machine.
An array of
RPC
-
subscribe() common/models/machine.js, line 189
-
Identical to
Lens.Capabilities.subscribe
, but adds this machine as filter.machine.