title: How to know if value changed in Parse Cloud Code afterSave hook?
body: <p>I want to send push notifications every time the value of a single key of my object changes in a parse cloud code <code>afterSave</code> hook.</p>
  
  <pre><code>Parse.Cloud.afterSave("Channel", function(request) {  
      var channel = request.object
      // TODO: check if value of channel key "state" was changed
  });
  </code></pre>
  
  <p>How can I check if the value of the key <code>state</code> was updated?</p>
  
  <p>This is all data I can get from the <code>request</code> object: <a href="http://parseplatform.org/Parse-SDK-JS/api/v1.11.0/Parse.Cloud.html#.TriggerRequest" rel="noreferrer">http://parseplatform.org/Parse-SDK-JS/api/v1.11.0/Parse.Cloud.html#.TriggerRequest</a></p>
  
  <p>The solution suggested in this thread feels wrong: <a href="https://stackoverflow.com/questions/30207102/parse-javascript-api-cloud-code-aftersave-with-access-to-beforesave-values">Parse Javascript API Cloud Code afterSave with access to beforeSave values</a></p>
  
  <p>I know I can do this via the dirty method in the <code>beforeSave</code> hook. However this does not work for me. Why? If I do send push notifications to many users this takes some time. The clients receiving the push notifications start requesting the updated channel object from the server. However they might receive an old version of the object because as long as <code>beforeSave</code> has not finished sending all pushes the channel object is not persisted in the database.</p>