I am using firebase, firepad and ace technology. I am able to write a document by firepad and ace and stores it in firebase, at different times.I see history being generated in firebase. Next thing is I need to add piece of code, where I can retrieve the document at any point in history. I wrote the following code:
sObj.once('value', function(historySnapshot){
// Get each revision Id
historySnapshot.forEach(function(itemSnapshot) {
var name = 'history/'+itemSnapshot.name();
console.log(name);
var idref = sObj.child(name);
/* Here I can read each revision object, find the operation and apply that change
in ace editor */
});
});
One way to read revision object is JSon parsing, know what operation is there. Apply that operation on the editor. constructing code what operation corresponds to what can be tedious.
Other than this are there any functions, which can avoid parsing and can directly tell me what operation to apply.
I saw getText function but that tells the current value. I need to see value at any point in the given history.