ObjDiffer test

ObjDiffer's purpose is to lower the payload for the server. You can predefine one general set of values to be shared between every user. If a user then changes something only the changes are saved to his/her account.

General settings
Site title:
Colors
Background:
Text:

apply predefined patch | restore original

click here to see the diff

If you apply the "patch" (changes title and the text color values) or edit the values by yourself, you can generate a diff value based on the differences between the current and the original values. You can save the diff in some kind of serialized form (ie. JSON) and later reapply the saved changes to the original values.

* Example

- Initial visit:

var settings = new ObjDiffer(general_settings);
settings.value.on_page_item_count = 5;
var diff = settings.getDiff(); // {"on_page_item_count":5}
save_to_server(diff);

Next visits:

var patch = load_from_server();
var settings = new ObjDiffer(general_settings, patch);
alert(settings.value.on_page_item_count); // 5

Download from GitHub