Skip to content

Commit

Permalink
Introduce event selection-start and selection-end
Browse files Browse the repository at this point in the history
* `load-selection` is renamed to `selection-start`

- `selection-start` is triggered only once, when a new selection starts
- `selection-end` is triggered, when user stop selecting

Remove superfluos params of trigger method
  • Loading branch information
sukhwinder33445 committed Jul 4, 2024
1 parent cffaade commit c1351b0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions asset/js/widget/ActionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ define(["../notjQuery"], function (notjQuery) {
if (activeItems.length === 1
&& toActiveItems.length === 0
) {
notjQuery(this.list).trigger('all-deselected', {target: target, actionList: this});
notjQuery(this.list).trigger('all-deselected');

this.clearSelection(toDeactivateItems);
this.addSelectionCountToFooter();
Expand Down Expand Up @@ -443,16 +443,17 @@ define(["../notjQuery"], function (notjQuery) {
return;
}

if (this.lastTimeoutId === null) { // trigger once, when just started selecting list items
notjQuery(this.list).trigger('selection-start');
}

clearTimeout(this.lastTimeoutId);
this.lastTimeoutId = setTimeout(() => {
this.lastTimeoutId = null;

// TODO: maybe we need a property to know if a req is in process

notjQuery(this.list).trigger(
'load-selection',
{url: url, firstActiveItem: activeItems[0]}
);
notjQuery(this.list).trigger('selection-end', {url: url});
}, 250);
}

Expand Down

0 comments on commit c1351b0

Please sign in to comment.