new DataManager(config) → {object}
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
|
- Source:
- data-manager/aerogear.datamanager.js, line 58
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
- Source:
- data-manager/aerogear.datamanager.js, line 88
-
<static> this.collectionName :Object
-
The name used to reference the collection of data store instances created from the adapters
- Default Value:
- stores
- Source:
- data-manager/aerogear.datamanager.js, line 76