Class: Core

Core

new Core()

Creates a new ForerunnerDB instance. Core instances handle the lifecycle of multiple database instances.
Source:

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.
Source:

(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.
Source:

(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.
Source:

(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.
Source:
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.
Source:

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.
Source:
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.
Source:
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.
Source:
Returns:
Array of instances or a single instance.
Type
Array | Object

instantiatedCount() → {Number}

Returns the number of instantiated ForerunnerDB objects.
Source:
Returns:
The number of instantiated instances.
Type
Number

isClient() → {boolean}

Returns true if ForerunnerDB is running on a client browser.
Source:
Returns:
Type
boolean

isClient() → {Boolean}

Checks if the database is running on a client (browser) or a server (node.js).
Source:
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).
Source:
Returns:
Returns true if running on a server.
Type
Boolean

isServer() → {boolean}

Returns true if ForerunnerDB is running on a server.
Source:
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.
Source:
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.
Source:
Returns:
Type
Boolean