new DataManager(config) → {object}
Status: Stable
A collection of data connections (stores) and their corresponding data models. This object provides a standard way to interact with client side data no matter the data format or storage mechanism used.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
String | Array | Object |
<optional> |
A configuration for the store(s) being created along with the DataManager. If an object or array containing objects is used, the objects can have the following properties:
Properties
|
Returns:
dataManager - The created DataManager containing any stores that may have been created
- Type
- object
Example
// Create an empty DataManager
var dm = AeroGear.DataManager();
// Create a single store using the default adapter
var dm2 = AeroGear.DataManager( "tasks" );
// Create multiple stores using the default adapter
var dm3 = AeroGear.DataManager( [ "tasks", "projects" ] );
// Create a custom store
var dm3 = AeroGear.DataManager({
name: "mySessionStorage",
type: "SessionLocal",
id: "customID"
});
// Create multiple custom stores
var dm4 = AeroGear.DataManager([
{
name: "mySessionStorage",
type: "SessionLocal",
id: "customID"
},
{
name: "mySessionStorage2",
type: "SessionLocal",
id: "otherId",
settings: { ... }
}
]);
Extends
- AeroGear.Core
Members
-
<static> adapters
-
The adapters object is provided so that adapters can be added to the AeroGear.DataManager namespace dynamically and still be accessible to the add method
-
<static> preferred
-
preferred adapters for the fallback strategy
-
<static> this.collectionName :Object
-
The name used to reference the collection of data store instances created from the adapters
Type:
- Object
- Default Value:
- stores
- Source:
-
<static> validAdapters
-
Stores the valid adapters
Methods
-
<static> validateAdapter()
-
Method to determine and store what adapters are valid for this environment