commit example
/* This is an example of a function you might have in your code for committing a "post" entry in a blog or social-media-sharing type of app. It illustrates two aspects of committing data to your local chain. The first is committing a regular "data" style entry, and the second is committing Holochain's links type entry. When you commit a post, you would probably also want to commit links on your identity hash for people to be able to look up a list of your posts. Make sure that you complete the proper validation functions too. For the first commit, you will need to check your validateCommit and validatePut functions, for the second commit, you'll need to check validateCommit, validatePut, and validateLink. */

function createPost(post) {
  // Commit post entry to my source chain
  var hash = commit("post",post);
  // On the DHT, put a link from my hash to the hash of the new post
  var me = App.Agent.Hash;
  commit("post_links",{    
    Links: [
      {Base: me,Link: hash, Tag: "post"}
    ]
  });
  // Returns the hash of the new post to the caller
  return hash;
}

// Note that if you want to "remove" a links type entry, you also use commit. That looks something like this:
function removePost(postHash) {
  // Use remove to remove the post entry
  remove(postHash);
  // On the DHT, mark the links as deleted
  var me = App.Agent.Hash;
  commit("post_links",{
    Links: [
      {
        Base: me,
        Link: postHash,
        Tag: "post",
        LinkAction: HC.LinkAction.Del
      }
    ]
  });
  // return success
  return true;
}