Skip to content

Commit d37967a

Browse files
committed
Update function names
1 parent 28ba566 commit d37967a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/service-module/service-module.events.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ export function enableServiceEvents({ service, Model, store, options }): void {
66
const debounceMap = {
77
addOrUpdateById: {},
88
removeItemById: {},
9-
addOrUpdate(item): void {
9+
queueAddOrUpdate(item): void {
1010
const id = getId(item, options.idField)
1111
this.addOrUpdateById[id] = item
1212
if (this.removeItemById.hasOwnProperty(id)) {
1313
delete this.removeItemById[id]
1414
}
15-
this.debouncedAddOrUpdate()
15+
this.flushAddOrUpdateQueue()
1616
},
17-
removeItem(item): void {
17+
queueRemoval(item): void {
1818
const id = getId(item, options.idField)
1919
this.removeItemById[id] = item
2020
if (this.addOrUpdateById.hasOwnProperty(id)) {
2121
delete this.addOrUpdateById[id]
2222
}
23-
this.debouncedRemoveItem()
23+
this.flushRemoveItemQueue()
2424
},
25-
debouncedAddOrUpdate: _debounce(async function () {
25+
flushAddOrUpdateQueue: _debounce(async function () {
2626
const values = Object.values(this.addOrUpdateById)
2727
if (values.length === 0) return
2828
await store.dispatch(`${options.namespace}/addOrUpdateList`, {
@@ -31,7 +31,7 @@ export function enableServiceEvents({ service, Model, store, options }): void {
3131
})
3232
this.addOrUpdateById = {}
3333
}, options.debounceEventsTime || 20),
34-
debouncedRemoveItem: _debounce(function () {
34+
flushRemoveItemQueue: _debounce(function () {
3535
const values = Object.values(this.removeItemById)
3636
if (values.length === 0) return
3737
store.commit(`${options.namespace}/removeItems`, values)
@@ -55,8 +55,8 @@ export function enableServiceEvents({ service, Model, store, options }): void {
5555
: store.dispatch(`${options.namespace}/${mutationName}`, modified)
5656
} else {
5757
eventName === 'removed'
58-
? debounceMap.removeItem(item)
59-
: debounceMap.addOrUpdate(item)
58+
? debounceMap.queueRemoval(item)
59+
: debounceMap.queueAddOrUpdate(item)
6060
}
6161
}
6262
}

0 commit comments

Comments
 (0)