Permalink
Browse files

more inline examples

  • Loading branch information...
1 parent b063705 commit 578e7773cd5f3fa07d3a51772683822e07cb3c62 @lholmquist lholmquist committed Mar 26, 2013
@@ -15,6 +15,7 @@
*/
/**
The REST adapter is the default type used when creating a new authentication module. It uses jQuery.ajax to communicate with the server.
+ This constructor is instantiated when the "Auth.add()" method is called
@constructs AeroGear.Auth.adapters.Rest
@param {String} moduleName - the name used to reference this particular auth module
@param {Object} [settings={}] - the settings to be passed to the adapter
@@ -30,6 +30,24 @@
// Create multiple modules using the default adapter
var auth3 = AeroGear.Auth( [ "someAuth", "anotherAuth" ] );
+
+ //Create a single module by passing an object using the default adapter
+ var auth4 = AeroGear.Auth(
+ {
+ name: "objectAuth"
+ }
+ );
+
+ //Create multiple modules by passing an array of objects using the default adapter
+ var auth5 = AeroGear.Auth([
+ {
+ name: "objectAuth"
+ },
+ {
+ name: "objectAuth2",
+ settings: { ... }
+ }
+ ]);
*/
AeroGear.Auth = function( config ) {
// Allow instantiation without using new
@@ -15,6 +15,7 @@
*/
/**
The Memory adapter is the default type used when creating a new store. Data is simply stored in a data var and is lost on unload (close window, leave page, etc.)
+ This constructor is instantiated when the "DataManager.add()" method is called
@constructs AeroGear.DataManager.adapters.Memory
@param {String} storeName - the name used to reference this particular store
@param {Object} [settings={}] - the settings to be passed to the adapter
@@ -26,7 +27,10 @@
var dm = AeroGear.DataManager();
//Add a custom memory store
- dm.add( "newStore", { recordId: "customID" });
+ dm.add( "newStore", {
+ recordId: "customID"
+ });
+
*/
AeroGear.DataManager.adapters.Memory = function( storeName, settings ) {
// Allow instantiation without using new
@@ -171,6 +175,19 @@ AeroGear.DataManager.adapters.Memory.prototype.read = function( id ) {
...
});
+ //Store an array of new Tasks
+ dm.save([
+ {
+ title: "Task2",
+ date: "2012-07-13"
+ },
+ {
+ title: "Task3",
+ date: "2012-07-13"
+ ...
+ }
+ ]);
+
// Update an existing piece of data
var toUpdate = dm.read()[ 0 ];
toUpdate.data.title = "Updated Task";
@@ -15,6 +15,7 @@
*/
/**
The SessionLocal adapter extends the Memory adapter to store data in either session or local storage which makes it a little more persistent than memory
+ This constructor is instantiated when the "DataManager.add()" method is called
@constructs AeroGear.DataManager.adapters.SessionLocal
@mixes AeroGear.DataManager.adapters.Memory
@param {String} storeName - the name used to reference this particular store
@@ -28,7 +29,10 @@
var dm = AeroGear.DataManager();
//Add a custom SessionLocal store using local storage as its storage type
- dm.add( "newStore", { recordId: "customID", storageType: "localStorage" });
+ dm.add( "newStore", {
+ recordId: "customID",
+ storageType: "localStorage"
+ });
*/
AeroGear.DataManager.adapters.SessionLocal = function( storeName, settings ) {
// Allow instantiation without using new
@@ -97,6 +101,19 @@ AeroGear.DataManager.adapters.SessionLocal.prototype = Object.create( new AeroGe
...
});
+ //Store an array of new Tasks
+ dm.save([
+ {
+ title: "Task2",
+ date: "2012-07-13"
+ },
+ {
+ title: "Task3",
+ date: "2012-07-13"
+ ...
+ }
+ ]);
+
// Update an existing piece of data
var toUpdate = dm.read()[ 0 ];
toUpdate.data.title = "Updated Task";
@@ -34,11 +34,26 @@
var dm3 = AeroGear.DataManager( [ "tasks", "projects" ] );
//Create a custom store
- var dm3 = AeroGear.DataManager([{
+ 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: { ... }
+ }
+ ]);
*/
AeroGear.DataManager = function( config ) {
// Allow instantiation without using new
@@ -15,6 +15,7 @@
*/
/**
The REST adapter is the default type used when creating a new pipe. It uses jQuery.ajax to communicate with the server. By default, the RESTful endpoint used by this pipe is the app's current context, followed by the pipe name. For example, if the app is running on http://mysite.com/myApp, then a pipe named `tasks` would use http://mysite.com/myApp/tasks as its REST endpoint.
+ This constructor is instantiated when the "PipeLine.add()" method is called
@constructs AeroGear.Pipeline.adapters.Rest
@param {String} pipeName - the name used to reference this particular pipe
@param {String} [type="Rest"] - the name used to reference this particular pipe
@@ -33,12 +33,26 @@
// Create multiple pipes using the default adapter
var pl3 = AeroGear.Pipeline( [ "tasks", "projects" ] );
- //Create a new REST pipe with a custom ID
- var pl4 = AeroGear.Pipeline([{
+ //Create a new REST pipe with a custom ID using an object
+ var pl4 = AeroGear.Pipeline({
name: "customPipe",
type: "rest",
recordId: "CustomID"
- }])
+ });
+
+ //Create multiple REST pipes using objects
+ var pl5 = AeroGear.Pipeline([
+ {
+ name: "customPipe",
+ type: "rest",
+ recordId: "CustomID"
+ },
+ {
+ name: "customPipe2",
+ type: "rest",
+ recordId: "CustomID"
+ }
+ ]);
*/
AeroGear.Pipeline = function( config ) {
// Allow instantiation without using new

0 comments on commit 578e777

Please sign in to comment.