new Core()
Creates a new ForerunnerDB instance. Core instances handle the lifecycle of
multiple database instances.
Methods
(static) moduleLoaded(moduleName, callback)
Checks if a module is loaded and if so calls the passed
callback method.
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
String | The name of the module to check for. |
callback |
function | The callback method to call if module is loaded. |
(static) moduleLoaded(moduleName, success, failure)
Checks if a module is loaded and if so calls the passed
success method, otherwise calls the failure method.
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
String | The name of the module to check for. |
success |
function | The callback method to call if module is loaded. |
failure |
function | The callback method to call if module not loaded. |
(static) moduleLoaded(moduleName, callback)
Checks if an array of named modules are loaded and if so
calls the passed callback method.
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
Array | The array of module names to check for. |
callback |
function | The callback method to call if modules are loaded. |
(static) moduleLoaded(moduleName) → {Boolean}
Checks if a module has been loaded into the database.
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
String | The name of the module to check for. |
Returns:
True if the module is loaded, false if not.
- Type
- Boolean
collection()
Added to provide an error message for users who have not seen
the new instantiation breaking change warning and try to get
a collection directly from the core instance.
databases(search) → {Array}
Returns an array of databases that ForerunnerDB currently has.
Parameters:
Name | Type | Description |
---|---|---|
search |
String | RegExp | The optional search string or regular expression to use to match collection names against. |
Returns:
An array of objects containing details of each database
that ForerunnerDB is currently managing and it's child entities.
- Type
- Array
db(nameopt) → {Db}
Gets a database instance by name.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String |
<optional> |
Optional name of the database. If none is provided a random name is assigned. |
Returns:
- Type
- Db
instances(indexopt) → {Array|Object}
Get all instances as an array or a single ForerunnerDB instance
by it's array index.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
Number |
<optional> |
Optional index of instance to get. |
Returns:
Array of instances or a single instance.
- Type
- Array | Object
instantiatedCount() → {Number}
Returns the number of instantiated ForerunnerDB objects.
Returns:
The number of instantiated instances.
- Type
- Number
isClient() → {boolean}
Returns true if ForerunnerDB is running on a client browser.
Returns:
- Type
- boolean
isClient() → {Boolean}
Checks if the database is running on a client (browser) or
a server (node.js).
Returns:
Returns true if running on a browser.
- Type
- Boolean
isServer() → {Boolean}
Checks if the database is running on a client (browser) or
a server (node.js).
Returns:
Returns true if running on a server.
- Type
- Boolean
isServer() → {boolean}
Returns true if ForerunnerDB is running on a server.
Returns:
- Type
- boolean
namedInstances(nameopt) → {Array|Object}
Get all instances as an array of instance names or a single ForerunnerDB
instance by it's name.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String |
<optional> |
Optional name of instance to get. |
Returns:
Array of instance names or a single instance.
- Type
- Array | Object
version(val, callback) → {Boolean}
Checks version against the string passed and if it matches (or partially matches)
then the callback is called.
Parameters:
Name | Type | Description |
---|---|---|
val |
String | The version to check against. |
callback |
function | The callback to call if match is true. |
Returns:
- Type
- Boolean