Developer Preview: We welcome developer feedback on this project. You can reach us by creating an issue on the GitHub repository or post to the Amazon Cognito forums:
Note: This library is designed to run in the browser. It has not been tested for use in other environments.
Step 1. Log into Amazon Cognito management console and create a new identity pool. Be sure to enable the "unauthenticated identities" option. On the last step of the wizard, make a note of your Account ID, Identity Pool ID, and Unauthenticated Role ARN.
AWSconfigregion = 'us-east-1';AWSconfigcredentials =IdentityPoolId: 'YOUR IDENTITY POOL ID';
Step 3. Make the call to obtain the credentials you configured, and in the callback, instantiate the CognitoSyncManager class. It will assume the credentials from the AWS SDK.
Step 4. Now you need to open or create a new dataset to start saving data to. Call .openOrCreateDataset() and pass in the desired dataset name.
Step 5. Once you have the dataset object, you can write, read, and delete records to that dataset. It is also possible to get all the records from a given dataset, get the amount of data used by a dataset, and more.
<!-- Read Records -->dataset;<!-- Write Records -->dataset;<!-- Delete Records -->dataset;
Step 6. Finally, synchronize the data to Cognito. You pass the synchronize function an object with callbacks to handle the various outcomes: onSuccess, onFailure, onConflict, onDatasetsMerged, onDatasetDeleted.
<!-- Synchronize -->dataset;
- Initial release. Developer preview.