Skip to content

Commit

Permalink
Migrate event nodes disposing to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
Rochmar Nicolas (DevExpress) committed Jul 22, 2024
1 parent 05ac05e commit 4e37a6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import eventsEngine from '../core/events_engine';
import { removeEvent } from '../remove';
import eventsEngine from '@js/events/core/events_engine';
import { removeEvent } from '@js/events/remove';

function nodesByEvent(event) {
return event && [
event.target,
event.delegateTarget,
event.relatedTarget,
event.currentTarget
].filter(node => !!node);
return event && [
event.target,
event.delegateTarget,
event.relatedTarget,
event.currentTarget,
].filter((node) => !!node);
}

export const subscribeNodesDisposing = (event, callback) => {
eventsEngine.one(nodesByEvent(event), removeEvent, callback);
// @ts-expect-error
eventsEngine.one(nodesByEvent(event), removeEvent, callback);
};

export const unsubscribeNodesDisposing = (event, callback) => {
eventsEngine.off(nodesByEvent(event), removeEvent, callback);
eventsEngine.off(nodesByEvent(event), removeEvent, callback);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../../__internal/events/utils/m_event_nodes_disposing';

0 comments on commit 4e37a6b

Please sign in to comment.