Skip to content

Commit

Permalink
fix: condion for onMessage types
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Oct 19, 2023
1 parent 6fc1c16 commit 1c7b131
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,16 @@
// TODO: we need to delete queued items based on some conditions to prevent conflicts
// what are the conditions?
let type = message.method.split('.').pop()
for (let item of message[type]) {
if (type == 'object') {
Data.$filter.query.push({ key: 'data._id', value: item._id, operator: '$eq' })
} else if (['database', 'array', 'index',].includes(type)) {
Data.$filter.query.push({ key: 'data.name', value: item.name, operator: '$eq' })
if (Array.isArray(message[type])) {
for (let item of message[type]) {
if (type == 'object') {
Data.$filter.query.push({ key: 'data._id', value: item._id, operator: '$eq' })
} else if (['database', 'array', 'index',].includes(type)) {
Data.$filter.query.push({ key: 'data.name', value: item.name, operator: '$eq' })
}
}
// indexeddb.send(Data)
}
// indexeddb.send(Data)
}
}

Expand All @@ -255,6 +257,8 @@
process.emit(message.uid, message);
}
}
if (message.method === 'updateUserStatus' && message.userStatus === 'on')
console.log('test')

self.__fireListeners(message)
} catch (e) {
Expand Down

0 comments on commit 1c7b131

Please sign in to comment.