Skip to content

Commit

Permalink
fix: added listener for update and create
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Oct 9, 2023
1 parent 1e89f1d commit 86c3f43
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/index.js
Expand Up @@ -222,8 +222,8 @@ function insertChange(data, flag) {
function broadcastChange(data) {
message.send({
room: "",
broadcastSender: 'false',
broadcastBrowser: 'once',
broadcastSender: false,
broadcastBrowser: true,
message: "crdt",
data
});
Expand Down Expand Up @@ -278,7 +278,10 @@ message.listen('crdt', function (response) {
}
});

crud.listen('sync', function (data) {
crud.listen('update.object', (data) => sync(data))
crud.listen('delete.object', (data) => sync(data))

function sync(data) {
if (data.array.includes('crdt-transactions')) {
if (data.object && data.object[0]) {
let Data = data.object[0];
Expand All @@ -297,8 +300,8 @@ crud.listen('sync', function (data) {
}
}
}
});

}

/*
crdt.getText({
Expand Down

0 comments on commit 86c3f43

Please sign in to comment.