Skip to content

Commit fdf0f24

Browse files
committed
__deltaToPatch
1 parent eee7ade commit fdf0f24

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

services/static-webserver/client/source/class/osparc/wrapper/JsonDiffPatch.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ qx.Class.define("osparc.wrapper.JsonDiffPatch", {
5151

5252
members: {
5353
__diffPatcher: null,
54+
__deltaToPatch: null,
5455

5556
init: function() {
5657
// initialize the script loading
@@ -64,6 +65,9 @@ qx.Class.define("osparc.wrapper.JsonDiffPatch", {
6465

6566
this.__diffPatcher = jsondiffpatch.create();
6667

68+
const JsonPatchFormatter = jsondiffpatch.formatters.jsonpatch;
69+
this.__deltaToPatch = new JsonPatchFormatter();
70+
6771
this.setLibReady(true);
6872
}, this);
6973

@@ -84,8 +88,8 @@ qx.Class.define("osparc.wrapper.JsonDiffPatch", {
8488
// format to JSON PATCH (RFC 6902)
8589
// https://github.com/benjamine/jsondiffpatch/blob/master/docs/formatters.md
8690
deltaToJsonPatch: function(delta) {
87-
if (this.__diffPatcher.formatters) {
88-
const patch = this.__diffPatcher.formatters.jsonpatch.format(delta);
91+
if (this.__deltaToPatch) {
92+
const patch = this.__deltaToPatch.format(delta);
8993
console.log("(RFC 6902)", patch);
9094
}
9195
},

0 commit comments

Comments
 (0)