For more details about the APIs used, see the Hub SDK API Reference.
Running the sample app
To run the sample app, clone this repository locally and then run:
npm install npm run build npm run start
How it works
The sample app stores objects representing to-do items in your Hub:
When you add a new to-do, the app authors a
createcommit to instantiate a new object and issues a
HubWriteRequestto commit the operation to your Hub.
When you change the
donestate of a to-do, the app authors an
updatecommit. This commit references the
object_idof the to-do and contains the updated to-do state. The app then issues a
HubWriteRequestto commit the update operation to your Hub.
When you delete a to-do, the app authors a
deletecommit referencing the
object_idof the to-do and issues a
HubWriteRequestto commit the delete operation to your Hub.
When you close and re-open the app, the app fetches any existing to-dos from your Hub. The app issues a
HubObjectQueryRequestto identify the
object_ids of all objects having the to-do schema. The app then issues a
HubCommitQueryRequestto retrieve the constituent commits of all of the identified objects. Once all commits are retrieved, the app uses the
CommitStrategyBasicstrategy to compile the commits into the final state of each to-do.
The code interacting with the Hub JS SDK is mostly found in the